srcdev-nuxt-components 1.2.0 → 1.2.2

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.
@@ -0,0 +1,7 @@
1
+ .display-flex {
2
+ display: flex;
3
+ }
4
+
5
+ .display-grid {
6
+ display: grid;
7
+ }
@@ -0,0 +1,73 @@
1
+ /*
2
+ * <div placement="top-left"></siv>
3
+ * <div placement="bottom-right"></siv>
4
+ **/
5
+
6
+ [placement^='top'] {
7
+ align-self: start;
8
+ }
9
+
10
+ [placement^='bottom'] {
11
+ align-self: end;
12
+ }
13
+
14
+ [placement^='center'] {
15
+ align-self: center;
16
+ }
17
+
18
+ [placement$='left'] {
19
+ justify-self: start;
20
+ }
21
+
22
+ [placement$='right'] {
23
+ justify-self: start;
24
+ }
25
+
26
+ [placement$='center'] {
27
+ align-self: center;
28
+ }
29
+
30
+ /*
31
+ * <div align-content="top-left"></siv>
32
+ * <div align-content="bottom-right"></siv>
33
+ **/
34
+
35
+ [align-content^='center'] {
36
+ align-items: center;
37
+ }
38
+
39
+ [align-content^='top'] {
40
+ align-items: start;
41
+ }
42
+
43
+ [align-content^='bottom'] {
44
+ align-items: end;
45
+ }
46
+
47
+ [align-content$='center'] {
48
+ justify-content: center;
49
+ }
50
+
51
+ [align-content$='left'] {
52
+ justify-content: start;
53
+ }
54
+
55
+ [align-content$='right'] {
56
+ justify-content: end;
57
+ }
58
+
59
+ [align-content$='space-around'] {
60
+ justify-content: space-around;
61
+ }
62
+
63
+ [align-content$='space-between'] {
64
+ justify-content: space-between;
65
+ }
66
+
67
+ [gap='12px'] {
68
+ gap: 12px;
69
+ }
70
+
71
+ [flex-wrap='wrap'] {
72
+ flex-wrap: wrap;
73
+ }
@@ -2,3 +2,5 @@
2
2
  @import './_margin-helpers';
3
3
  @import './_padding-helpers';
4
4
  @import './_canvasWidths';
5
+ @import './_display';
6
+ @import './_placement';
@@ -79,11 +79,6 @@ const updateGrid = () => {
79
79
  const minHeight = Math.min(...colHeights);
80
80
  const minIndex = colHeights.indexOf(minHeight);
81
81
 
82
- // item.style.position = 'absolute';
83
- // item.style.top = minHeight + 'px';
84
- // item.style.width = itemWidth + 'px';
85
- // item.style.left = minIndex * (100 / columnCount.value) + '%';
86
-
87
82
  item?.style.setProperty('--_position', 'absolute');
88
83
  item?.style.setProperty('--_position-top', minHeight + 'px');
89
84
  item?.style.setProperty('--_position-left', minIndex * (100 / columnCount.value) + '%');
@@ -93,8 +88,6 @@ const updateGrid = () => {
93
88
  });
94
89
 
95
90
  const maxHeight = Math.max(...colHeights);
96
-
97
- // gridWrapper.value.style.height = maxHeight + 'px';
98
91
  gridWrapper.value?.style.setProperty('--_wrapper-height', maxHeight + 'px');
99
92
  }
100
93
  };
@@ -120,9 +113,14 @@ watch(
120
113
 
121
114
  <style scoped lang="css">
122
115
  .masonry-grid-ordered {
116
+ --_border-color: light-dark(hsl(0, 29%, 3%), hsl(0, 0%, 92%));
117
+ --_transition-duration: 0.3s;
118
+
123
119
  container-type: inline-size;
124
120
  position: relative;
125
121
 
122
+ transition: max-width var(--_transition-duration) ease;
123
+
126
124
  .masonry-grid-ordered-wrapper {
127
125
  display: grid;
128
126
  justify-self: v-bind(justify);
@@ -144,12 +142,16 @@ watch(
144
142
  }
145
143
 
146
144
  .masonry-grid-ordered-item {
147
- transition: position 0.3s ease, top 0.3s ease, left 0.3s ease;
145
+ transition: position var(--_transition-duration) ease, top var(--_transition-duration) ease, left var(--_transition-duration) ease;
148
146
 
149
147
  position: var(--_position);
150
148
  top: var(--_position-top);
151
149
  left: var(--_position-left);
152
150
  width: var(--_element-width);
151
+
152
+ outline: 0.1rem solid var(--_border-color);
153
+ padding: 1.2rem;
154
+ border-radius: 4px;
153
155
  }
154
156
  }
155
157
  }
@@ -46,12 +46,15 @@ watch(
46
46
 
47
47
  <style lang="css">
48
48
  .masonry-grid-wrapper {
49
+ --_border-color: light-dark(hsl(0, 29%, 3%), hsl(0, 0%, 92%));
50
+ --_color: light-dark(hsl(0, 29%, 3%), hsl(0, 0%, 92%));
51
+
49
52
  columns: var(--_item-min-width);
50
- gap: var(--_masonry-grid-gap);
53
+ gap: 12px;
51
54
 
52
55
  .masonry-grid-item {
53
56
  break-inside: avoid;
54
- outline: 0.1rem solid #cdcdcd;
57
+ outline: 0.1rem solid var(--_border-color);
55
58
  padding: 1.2rem;
56
59
  margin-block-end: var(--_masonry-grid-gap);
57
60
  }
@@ -100,12 +100,14 @@ watch(
100
100
 
101
101
  <style lang="css">
102
102
  .masonry-grid-wrapper {
103
+ --_border-color: light-dark(hsl(0, 29%, 3%), hsl(0, 0%, 92%));
104
+
103
105
  columns: var(--_item-min-width);
104
106
  gap: var(--_masonry-grid-gap);
105
107
 
106
108
  .masonry-grid-item {
107
109
  break-inside: avoid;
108
- outline: 0.1rem solid #cdcdcd;
110
+ outline: 0.1rem solid var(--_border-color);
109
111
  padding: 1.2rem;
110
112
  margin-block-end: var(--_masonry-grid-gap);
111
113
  }
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <component
3
+ :is="tag"
4
+ class="rotating-carousel"
5
+ :class="[elementClasses]"
6
+ :style="`--quantity: ${Object.keys(data).length}; --_rotate-x: ${rotateXProp}; --_perspective: ${perspectiveProp}; --_translateZ: ${translateZProp}; --_animation-play-state: ${
7
+ pauseOnHover ? 'paused' : 'running'
8
+ }`"
9
+ >
10
+ <div class="slider" style="--quantity: 10">
11
+ <div v-for="(item, key) in data" :key="key" class="item" :style="`--_position: ${key}`"><NuxtImg :src="item.src" :alt="item.alt" /></div>
12
+ </div>
13
+ </component>
14
+ </template>
15
+
16
+ <script lang="ts">
17
+ const TAGS_ALLOWED = <string[]>['div', 'p', 'span', 'section', 'article', 'aside', 'header', 'footer', 'main', 'nav', 'ul', 'ol'];
18
+ interface IAccordianData {
19
+ src: string;
20
+ alt: string;
21
+ }
22
+ </script>
23
+
24
+ <script setup lang="ts">
25
+ const props = defineProps({
26
+ data: {
27
+ type: Array as PropType<IAccordianData[]>,
28
+ default: () => [],
29
+ },
30
+ tag: {
31
+ type: String,
32
+ default: 'div',
33
+ validator(value: string) {
34
+ return TAGS_ALLOWED.includes(value);
35
+ },
36
+ },
37
+ rotateX: {
38
+ type: Number,
39
+ default: 0,
40
+ },
41
+ perspective: {
42
+ type: Number,
43
+ default: 1000,
44
+ },
45
+ translateZ: {
46
+ type: Number,
47
+ default: 1000,
48
+ },
49
+ pauseOnHover: {
50
+ type: Boolean,
51
+ default: false,
52
+ },
53
+ styleClassPassthrough: {
54
+ type: Array as PropType<string[]>,
55
+ default: () => [],
56
+ },
57
+ });
58
+
59
+ const rotateXProp = computed(() => `${props.rotateX.toString()}deg`);
60
+ const perspectiveProp = computed(() => `${props.perspective.toString()}px`);
61
+ const translateZProp = computed(() => `${props.translateZ.toString()}px`);
62
+
63
+ const { elementClasses, resetElementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
64
+
65
+ watch(
66
+ () => props.styleClassPassthrough,
67
+ () => {
68
+ resetElementClasses(props.styleClassPassthrough);
69
+ }
70
+ );
71
+ </script>
72
+
73
+ <style lang="css">
74
+ @keyframes autoRun {
75
+ from {
76
+ transform: perspective(var(--_perspective)) rotateX(var(--_rotate-x)) rotateY(0deg);
77
+ }
78
+ to {
79
+ transform: perspective(var(--_perspective)) rotateX(var(--_rotate-x)) rotateY(360deg);
80
+ }
81
+ }
82
+
83
+ .rotating-carousel {
84
+ width: 100%;
85
+ height: 100vh;
86
+ text-align: center;
87
+ overflow: hidden;
88
+ position: relative;
89
+
90
+ .slider {
91
+ position: absolute;
92
+ width: 200px;
93
+ height: 250px;
94
+ top: 10%;
95
+ left: calc(50% - 100px);
96
+ transform-style: preserve-3d;
97
+ transform: perspective(var(--_perspective));
98
+ animation: autoRun 30s linear infinite;
99
+ z-index: 2;
100
+
101
+ &:has(.item img:hover) {
102
+ animation-play-state: var(--_animation-play-state);
103
+ }
104
+
105
+ .item {
106
+ position: absolute;
107
+ inset: 0 0 0 0;
108
+ transform: rotateY(calc((var(--_position) - 1) * (360 / var(--quantity)) * 1deg)) translateZ(var(--_translateZ));
109
+
110
+ img {
111
+ width: 100%;
112
+ height: 100%;
113
+ object-fit: cover;
114
+ }
115
+ }
116
+ }
117
+ }
118
+ </style>
package/nuxt.config.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  export default defineNuxtConfig({
3
3
  devtools: { enabled: true },
4
4
  css: ['modern-normalize', './assets/styles/main.css'],
5
- modules: ['@nuxt/icon'],
5
+ modules: ['@nuxt/icon', '@nuxt/image'],
6
6
 
7
7
  app: {
8
8
  head: {
@@ -32,4 +32,4 @@ export default defineNuxtConfig({
32
32
  },
33
33
  // plugins: ['css-anchor-positioning'],
34
34
  compatibilityDate: '2024-07-13',
35
- });
35
+ });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.2.2",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",
@@ -29,6 +29,7 @@
29
29
  "@iconify-json/bitcoin-icons": "1.2.2",
30
30
  "@nuxt/eslint-config": "1.0.0",
31
31
  "@nuxt/icon": "1.10.3",
32
+ "@nuxt/image": "^1.9.0",
32
33
  "@oddbird/css-anchor-positioning": "0.4.0",
33
34
  "eslint": "9.19.0",
34
35
  "happy-dom": "16.8.1",