@d0rich/esprit-design 0.2.2 → 0.2.3

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 (46) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/index.html +13 -0
  3. package/package.json +1 -4
  4. package/plugins/shadows.js +87 -0
  5. package/src/components/DChip.vue +32 -0
  6. package/src/components/DPagination.vue +91 -0
  7. package/src/components/DStats.vue +502 -0
  8. package/src/components/animations/DAnimationAccordion.vue +103 -0
  9. package/src/components/animations/DAnimationDefLetterD.vue +11 -0
  10. package/src/components/animations/DAnimationFloatingLetter.vue +58 -0
  11. package/src/components/animations/DAnimationHypnosis.vue +102 -0
  12. package/src/components/animations/DAnimationSpinner.vue +114 -0
  13. package/src/components/animations/index.ts +11 -0
  14. package/src/components/buttons/DBigBangButton.vue +70 -0
  15. package/src/components/buttons/DBigBangButtonAnimation.vue +117 -0
  16. package/src/components/buttons/DBtn.vue +106 -0
  17. package/src/components/buttons/index.ts +5 -0
  18. package/src/components/cards/DCard.vue +98 -0
  19. package/src/components/cards/DCardTitle.vue +67 -0
  20. package/src/components/cards/index.ts +4 -0
  21. package/src/components/content/DAlert.vue +112 -0
  22. package/src/components/content/DQuote.vue +71 -0
  23. package/src/components/content/index.ts +4 -0
  24. package/src/components/index.ts +12 -0
  25. package/src/components/lists/DActionsFan.vue +153 -0
  26. package/src/components/lists/DActionsList.vue +100 -0
  27. package/src/components/lists/index.ts +4 -0
  28. package/src/components/utils/DWrapBackground.vue +76 -0
  29. package/src/components/utils/DWrapFocusHighlight.vue +241 -0
  30. package/src/components/utils/DWrapShape.vue +170 -0
  31. package/src/components/utils/index.ts +7 -0
  32. package/src/composables/big-bang-button-utils.ts +7 -0
  33. package/src/composables/index.ts +2 -0
  34. package/src/composables/router.ts +66 -0
  35. package/src/composables/utils.ts +5 -0
  36. package/src/index.ts +3 -0
  37. package/src/style.css +3 -0
  38. package/src/utils/boundings.ts +35 -0
  39. package/src/utils/index.ts +3 -0
  40. package/src/utils/pagination.ts +4 -0
  41. package/src/utils/polygon-animation.ts +139 -0
  42. package/src/vite-env.d.ts +1 -0
  43. package/tailwind.config.js +22 -0
  44. package/tsconfig.json +25 -0
  45. package/tsconfig.node.json +10 -0
  46. package/vite.config.ts +35 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # @d0rich/esprit-design
2
+
3
+ ## 0.2.3
4
+
5
+ ### Patch Changes
6
+
7
+ - f33f4d9: Update list of published files
8
+
9
+ ## 0.2.2
10
+
11
+ ### Patch Changes
12
+
13
+ - 73798aa: Build before publishing
14
+
15
+ ## 0.2.1
16
+
17
+ ### Patch Changes
18
+
19
+ - f0811da: Update publish config
20
+
21
+ ## 0.2.0
22
+
23
+ ### Minor Changes
24
+
25
+ - 660dbee: First published version
26
+
27
+ ## 0.1.0
28
+
29
+ ### Minor Changes
30
+
31
+ - c3d11c9: Extract components from Nuxt design system to the general Vue package
package/index.html ADDED
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/vite.svg" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <title>Vite + Vue + TS</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/src/main.ts"></script>
12
+ </body>
13
+ </html>
package/package.json CHANGED
@@ -1,13 +1,10 @@
1
1
  {
2
2
  "name": "@d0rich/esprit-design",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
7
7
  "type": "module",
8
- "files": [
9
- "dist"
10
- ],
11
8
  "main": "./dist/esprit-design.umd.cjs",
12
9
  "module": "./dist/esprit-design.js",
13
10
  "types": "./dist/index.d.ts",
@@ -0,0 +1,87 @@
1
+ /* eslint-disable @typescript-eslint/no-var-requires */
2
+ /** @type {import('tailwindcss/plugin')} */
3
+ const plugin = require('tailwindcss/plugin')
4
+ /** @type {import('tailwindcss/colors')} */
5
+ const colors = require('tailwindcss/colors')
6
+
7
+ const X_OFFSET_VAR = '--tw-ss-x-offset'
8
+ const Y_OFFSET_VAR = '--tw-ss-y-offset'
9
+ const COLOR_VAR = '--tw-ss-color'
10
+
11
+ const defaultStyle = {
12
+ [X_OFFSET_VAR]: '0px',
13
+ [Y_OFFSET_VAR]: '0px',
14
+ // [COLOR_VAR]: 'white',
15
+ '--tw-drop-shadow': `drop-shadow(var(${X_OFFSET_VAR}) var(${Y_OFFSET_VAR}) 0px var(${COLOR_VAR}))`,
16
+ filter:
17
+ 'var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)'
18
+ }
19
+
20
+ function direction2vector(direction) {
21
+ let x = 0
22
+ let y = 0
23
+ if (direction.includes('t')) y = -4
24
+ if (direction.includes('b')) y = 4
25
+ if (direction.includes('l')) x = -4
26
+ if (direction.includes('r')) x = 4
27
+ return { x, y }
28
+ }
29
+
30
+ function generateDirections() {
31
+ const directions = ['t', 'tr', 'tl', 'b', 'bl', 'br', 'r', 'l']
32
+ const offsets = [0, 1, 2, 3, 4, 5]
33
+ const result = {}
34
+ for (const dir of directions) {
35
+ const { x, y } = direction2vector(dir)
36
+ for (const offset of offsets) {
37
+ const newVariant = {
38
+ [X_OFFSET_VAR]: x * offset + 'px',
39
+ [Y_OFFSET_VAR]: y * offset + 'px'
40
+ }
41
+ if (x === 0) delete newVariant[X_OFFSET_VAR]
42
+ if (y === 0) delete newVariant[Y_OFFSET_VAR]
43
+ result[`.ss-${dir}-${offset}`] = newVariant
44
+ }
45
+ }
46
+ return result
47
+ }
48
+
49
+ function generateColors() {
50
+ const result = {}
51
+ for (const colorKey in colors) {
52
+ if (
53
+ [
54
+ 'inherit',
55
+ 'current',
56
+ 'transparent',
57
+ 'warmGray',
58
+ 'trueGray',
59
+ 'coolGray',
60
+ 'blueGray',
61
+ 'lightBlue'
62
+ ].includes(colorKey)
63
+ ) {
64
+ continue
65
+ }
66
+ if (typeof colors[colorKey] === 'string') {
67
+ result[`.ss-${colorKey}`] = {
68
+ [COLOR_VAR]: colors[colorKey]
69
+ }
70
+ } else if (typeof colors[colorKey] === 'object') {
71
+ for (const colorVariantKey in colors[colorKey]) {
72
+ result[`.ss-${colorKey}-${colorVariantKey}`] = {
73
+ [COLOR_VAR]: colors[colorKey][colorVariantKey]
74
+ }
75
+ }
76
+ }
77
+ }
78
+ return result
79
+ }
80
+
81
+ module.exports = plugin(function ({ addUtilities }) {
82
+ addUtilities({
83
+ '.sharp-shadow': defaultStyle,
84
+ ...generateDirections(),
85
+ ...generateColors()
86
+ })
87
+ })
@@ -0,0 +1,32 @@
1
+ <script lang="ts">
2
+ export default {
3
+ name: 'DChip'
4
+ }
5
+ </script>
6
+
7
+ <template>
8
+ <span class="d-chip">
9
+ <slot />
10
+ </span>
11
+ </template>
12
+
13
+ <style>
14
+ .d-chip {
15
+ display: inline-block;
16
+ clip-path: polygon(
17
+ 0 0,
18
+ 100% 0.2em,
19
+ calc(100% - 0.3em) 100%,
20
+ 0.2em calc(100% - 0.3em)
21
+ );
22
+ padding: 0.4em;
23
+ }
24
+
25
+ @media print {
26
+ .d-chip {
27
+ clip-path: none;
28
+ padding: 0;
29
+ background: unset !important;
30
+ }
31
+ }
32
+ </style>
@@ -0,0 +1,91 @@
1
+ <script lang="ts">
2
+ import { computed } from 'vue'
3
+ import { Icon } from '@iconify/vue'
4
+ import { useDPaginationUtils } from '../composables/utils'
5
+ import DBtn from './buttons/DBtn.vue'
6
+
7
+ export default {
8
+ name: 'DPagination',
9
+ components: {
10
+ DBtn,
11
+ Icon
12
+ }
13
+ }
14
+ </script>
15
+
16
+ <script setup lang="ts">
17
+ const props = defineProps({
18
+ currentPage: {
19
+ type: Number,
20
+ default: 1
21
+ },
22
+ allPages: {
23
+ type: Number,
24
+ required: true
25
+ },
26
+ baseLink: {
27
+ type: String,
28
+ required: true
29
+ }
30
+ })
31
+
32
+ const { getLinkToPaginatedPage } = useDPaginationUtils()
33
+
34
+ function getLinkToPage(page: number) {
35
+ return getLinkToPaginatedPage(props.baseLink, page)
36
+ }
37
+
38
+ const visiblePages = computed(() => {
39
+ return Array.from({ length: 7 }, (_, i) => i - 3 + props.currentPage).filter(
40
+ (num) => num >= 1 && num <= props.allPages
41
+ )
42
+ })
43
+ </script>
44
+
45
+ <template>
46
+ <nav class="w-fit text-2xl font-bold">
47
+ <DBtn
48
+ v-if="currentPage > 1"
49
+ class="inline-block mx-1"
50
+ :to="getLinkToPage(currentPage - 1)"
51
+ aria-label="Previous page"
52
+ >
53
+ <Icon icon="ic:baseline-arrow-back-ios" />
54
+ </DBtn>
55
+ <DBtn
56
+ v-if="!visiblePages.includes(1)"
57
+ class="inline-block mx-1"
58
+ :to="getLinkToPage(1)"
59
+ aria-label="First page"
60
+ >
61
+ 1
62
+ </DBtn>
63
+ <span v-if="!visiblePages.includes(1)" class="mx-1"> ... </span>
64
+ <DBtn
65
+ v-for="number in visiblePages"
66
+ :key="number"
67
+ class="inline-block mx-1"
68
+ :to="getLinkToPage(number)"
69
+ :aria-label="`Page ${number}`"
70
+ >
71
+ {{ number }}
72
+ </DBtn>
73
+ <span v-if="!visiblePages.includes(allPages)" class="mx-1"> ... </span>
74
+ <DBtn
75
+ v-if="!visiblePages.includes(allPages)"
76
+ class="inline-block mx-1"
77
+ :to="getLinkToPage(allPages)"
78
+ :aria-label="`Last page (${allPages})`"
79
+ >
80
+ {{ allPages }}
81
+ </DBtn>
82
+ <DBtn
83
+ v-if="currentPage < allPages"
84
+ class="inline-block mx-1"
85
+ :to="getLinkToPage(currentPage + 1)"
86
+ aria-label="Next page"
87
+ >
88
+ <Icon icon="ic:baseline-arrow-forward-ios" />
89
+ </DBtn>
90
+ </nav>
91
+ </template>