@d0rich/esprit-design 0.3.4 → 0.3.6

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.
@@ -12,7 +12,9 @@ export default {
12
12
 
13
13
  <script setup lang="ts">
14
14
  export type HighlightVariant =
15
+ | 'tile'
15
16
  | 'negative-tile'
17
+ | 'composite-tile'
16
18
  | 'list-item'
17
19
  | 'negative-list-item'
18
20
  | 'composite-list-item'
@@ -69,19 +71,30 @@ const currentComponent = computed(() => {
69
71
  class="d-focus-hl__hl--negative-tile"
70
72
  />
71
73
  <div
72
- v-else-if="variant === 'list-item'"
73
- class="d-focus-hl__hl--list-item"
74
+ v-else-if="variant === 'tile' || variant === 'composite-tile'"
75
+ class="d-focus-hl__hl--tile"
74
76
  :class="colorClass"
75
77
  />
76
78
  <div
77
79
  v-else-if="variant === 'negative-list-item'"
78
80
  class="d-focus-hl__hl--negative-list-item"
79
81
  />
80
- <template v-else-if="variant === 'composite-list-item'">
81
- <div class="d-focus-hl__hl--list-item" :class="colorClass" />
82
- <div class="d-focus-hl__hl--negative-list-item" />
83
- </template>
82
+ <div
83
+ v-else-if="variant === 'list-item' || variant === 'composite-list-item'"
84
+ class="d-focus-hl__hl--list-item"
85
+ :class="colorClass"
86
+ />
87
+
84
88
  <slot />
89
+
90
+ <div
91
+ v-if="variant === 'composite-tile'"
92
+ class="d-focus-hl__hl--negative-tile"
93
+ />
94
+ <div
95
+ v-else-if="variant === 'composite-list-item'"
96
+ class="d-focus-hl__hl--negative-list-item"
97
+ />
85
98
  </Component>
86
99
  </DWrapShape>
87
100
  </template>
@@ -89,7 +102,7 @@ const currentComponent = computed(() => {
89
102
  <!-- common -->
90
103
  <style>
91
104
  .d-focus-hl {
92
- @apply relative;
105
+ @apply relative isolate;
93
106
  }
94
107
  .d-focus-hl--default-color {
95
108
  @apply bg-red-600;
@@ -98,11 +111,11 @@ const currentComponent = computed(() => {
98
111
 
99
112
  <!-- negative-tile -->
100
113
  <style>
101
- .d-focus-hl:has(.d-focus-hl__hl--negative-tile) {
114
+ .d-focus-hl:has(.d-focus-hl__hl--negative-tile, .d-focus-hl__hl--tile) {
102
115
  @apply w-fit;
103
116
  }
104
117
 
105
- .d-focus-hl > .d-focus-hl__hl--negative-tile {
118
+ .d-focus-hl > :is(.d-focus-hl__hl--negative-tile, .d-focus-hl__hl--tile) {
106
119
  width: 0%;
107
120
  height: 0%;
108
121
  top: 50%;
@@ -110,23 +123,31 @@ const currentComponent = computed(() => {
110
123
  content: '';
111
124
  opacity: 0;
112
125
  pointer-events: none;
113
- @apply absolute backdrop-invert transition-all;
126
+ @apply absolute transition-all;
127
+ }
128
+
129
+ .d-focus-hl > .d-focus-hl__hl--negative-tile {
130
+ @apply backdrop-invert;
131
+ }
132
+
133
+ .d-focus-hl > .d-focus-hl__hl--tile {
134
+ @apply -z-10;
114
135
  }
115
136
 
116
- .d-focus-hl:hover > .d-focus-hl__hl--negative-tile,
117
- .d-focusable:focus .d-focus-hl__hl--negative-tile {
137
+ .d-focus-hl:hover > :is(.d-focus-hl__hl--negative-tile, .d-focus-hl__hl--tile),
138
+ .d-focusable:focus :is(.d-focus-hl__hl--negative-tile, .d-focus-hl__hl--tile) {
118
139
  opacity: 1;
119
140
  animation: hl--negative-tile-animation linear 1s infinite;
120
141
  }
121
142
 
122
- .d-focus-hl:hover > .d-focus-hl__hl--negative-tile {
143
+ .d-focus-hl:hover > :is(.d-focus-hl__hl--negative-tile, .d-focus-hl__hl--tile) {
123
144
  width: 110%;
124
145
  height: 130%;
125
146
  top: -15%;
126
147
  left: -5%;
127
148
  }
128
149
 
129
- .d-focusable:focus .d-focus-hl__hl--negative-tile {
150
+ .d-focusable:focus :is(.d-focus-hl__hl--negative-tile, .d-focus-hl__hl--tile) {
130
151
  width: 140% !important;
131
152
  height: 200% !important;
132
153
  top: -50% !important;
@@ -142,7 +163,7 @@ const currentComponent = computed(() => {
142
163
  ),
143
164
  .d-focus-hl--active
144
165
  )
145
- :is(.d-focus-hl__hl--negative-tile) {
166
+ :is(.d-focus-hl__hl--negative-tile, .d-focus-hl__hl--tile) {
146
167
  opacity: 1;
147
168
  width: 120% !important;
148
169
  height: 120% !important;
@@ -1,27 +1,69 @@
1
- <script lang="ts">
2
- import { type StyleValue } from 'vue'
1
+ <script setup lang="ts">
2
+ import { type StyleValue, computed } from 'vue'
3
3
 
4
- export default {
4
+ defineOptions({
5
5
  name: 'DWrapShape'
6
- }
7
- </script>
8
-
9
- <script setup lang="ts">
10
- defineProps<{
6
+ })
7
+ const props = defineProps<{
11
8
  shapeClass?: string | Record<string, boolean>
12
9
  shapeStyle?: StyleValue
13
10
  filterClass?: string | Record<string, boolean>
14
11
  filterStyle?: StyleValue
15
12
  tag?: string
16
13
  }>()
14
+
15
+ const slots = defineSlots<{
16
+ 'shape-content'?: () => {}
17
+ 'bg-overlay'?: () => {}
18
+ default?: () => {}
19
+ }>()
20
+
21
+ function isClassEmpty(
22
+ cls: string | Record<string, boolean> | undefined
23
+ ): boolean {
24
+ if (!cls) return true
25
+ if (typeof cls === 'string') return !cls.trim()
26
+ return Object.keys(cls).length === 0
27
+ }
28
+
29
+ function isStyleEmpty(style: StyleValue): boolean {
30
+ if (typeof style === 'string') return !style.trim()
31
+ if (Array.isArray(style)) return style.length === 0
32
+ if (style === null) return true
33
+ if (style === undefined) return true
34
+ return Object.keys(style).length === 0
35
+ }
36
+
37
+ const isShapeCustomized = computed(() => {
38
+ if (slots['shape-content']) return true
39
+ if (!isClassEmpty(props.shapeClass)) return true
40
+ return !isStyleEmpty(props.shapeStyle)
41
+ })
42
+ const isFilterCustomized = computed(() => {
43
+ if (!isClassEmpty(props.filterClass)) return true
44
+ return !isStyleEmpty(props.filterStyle)
45
+ })
17
46
  </script>
18
47
 
19
48
  <template>
20
49
  <Component :is="tag ?? 'div'">
21
50
  <div class="d-shape">
22
- <div class="d-shape__bg-filter" :class="filterClass" :style="filterStyle">
23
- <div class="d-shape__bg-wrapper">
24
- <div class="d-shape__bg" :class="shapeClass" :style="shapeStyle">
51
+ <div
52
+ v-if="isShapeCustomized || slots['bg-overlay'] || isFilterCustomized"
53
+ class="d-shape__bg-filter"
54
+ :class="filterClass"
55
+ :style="filterStyle"
56
+ >
57
+ <div
58
+ v-if="isShapeCustomized || slots['bg-overlay']"
59
+ class="d-shape__bg-wrapper"
60
+ >
61
+ <div
62
+ v-if="isShapeCustomized"
63
+ class="d-shape__bg"
64
+ :class="shapeClass"
65
+ :style="shapeStyle"
66
+ >
25
67
  <slot name="shape-content" />
26
68
  </div>
27
69
  <slot name="bg-overlay" />