libreria-astro-lefebvre 0.0.29 → 0.0.31

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libreria-astro-lefebvre",
3
- "version": "0.0.29",
3
+ "version": "0.0.31",
4
4
  "description": "Librería de componentes Astro, React y Vue para Lefebvre",
5
5
  "author": "Equipo web desarrollo Lefebvre",
6
6
  "type": "module",
@@ -1,235 +1,237 @@
1
- ---
2
- const {
3
- loadScript = true,
4
- items,
5
- slidesToShow = 5,
6
- slidesToScroll = 1,
7
- } = Astro.props;
8
-
9
- const carouselId = "glider-carousel-"+Math.floor(Math.random()*1000);
10
- const buttonsId = "glider-carousel-buttons-"+Math.floor(Math.random()*1000);
11
- const prevId = "glider-carousel-prev-"+Math.floor(Math.random()*1000);
12
- const nextId = "glider-carousel-next-"+Math.floor(Math.random()*1000);
13
-
14
- const randomId = Math.floor(Math.random() * 1000);
15
-
16
- const structuredData = `<script type="application/ld+json">
17
- {
18
- "@context": "https://schema.org",
19
- "@type": "ItemList",
20
- "name": "Carousel Items",
21
- "itemListElement": [
22
- ${items.map((item, index) => `{
23
- "@type": "ListItem",
24
- "position": ${index + 1},
25
- "item": {
26
- "@type": "${item.iframeSrc ? 'VideoObject' : 'ImageObject'}",
27
- ${item.iframeSrc ? `
28
- "name": "${item.description ? item.description.replace(/"/g, '\\"') : ''}",
29
- "description": "${item.description ? item.description.replace(/"/g, '\\"') : ''}",
30
- "embedUrl": "${item.iframeSrc}",
31
- "author": {
32
- "@type": "Person",
33
- "name": "${item.author ? item.author.replace(/"/g, '\\"') : ''}",
34
- "jobTitle": "${item.positionCompany ? item.positionCompany.replace(/"/g, '\\"') : ''}"
35
- }` : `
36
- "contentUrl": "${item.image}",
37
- "name": "${item.altImage ? item.altImage.replace(/"/g, '\\"') : ''}",
38
- "description": "${item.descriptionImage ? item.descriptionImage.replace(/"/g, '\\"') : ''}"`}
39
- }
40
- }`).join(',')}
41
- ]
42
- }
43
- </script>`;
44
-
45
- ---
46
-
47
- {loadScript &&
48
- <div>
49
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/glider-js@1/glider.min.css"/>
50
- <script src="https://cdn.jsdelivr.net/npm/glider-js@1/glider.min.js"></script>
51
- </div>
52
- }
53
-
54
- <style is:global>
55
- .glider-track{
56
- display: flex;
57
- align-items: start !important;
58
- }
59
- .glider-dots {
60
- display: none !important;
61
- }
62
- </style>
63
-
64
- <div class="w-full ">
65
- <div id={carouselId} class="glider w-full">
66
- {items.map((item, idx) => (
67
- <div class="flex flex-col items-center p-10 bg-white">
68
- {item.iframeSrc ? (
69
- <div class="w-full">
70
- <span class={`popup-iframe-trigger-${randomId} cursor-pointer`} data-iframesrc={item.iframeSrc}>
71
- <img src={item.imageSrc} class="w-full h-full rounded-2xl p-2 transition-transform hover:scale-105 cursor-pointer"/>
72
- </span>
73
- </div>
74
- <div class="p-6 flex-grow flex flex-col">
75
- <div class="mt-2 flex items-center gap-2 flex-grow">
76
- <div class="flex flex-col text-[#262626] h-full">
77
- <p class="text-base font-inter font-normal leading-[24px] mb-[24px]">{item.description}</p>
78
- <p class="text-[14px] font-semibold leading-[20px]">{item.author}<br />{item.positionCompany}</p>
79
- </div>
80
- </div>
81
- </div>
82
- ) : (
83
- <img src={item.image} alt={item.altImage} class="!max-w-[250px] w-fit" />
84
- <p>{item.descriptionImage}</p>
85
- )}
86
- </div>
87
- ))}
88
- </div>
89
- <div id={buttonsId} class="carouselGlider hidden md:flex"></div>
90
- </div>
91
-
92
- <div id={"popup-iframe-modal-" + randomId } class="fixed w-full h-full top-0 left-0 z-9999 hidden">
93
- <div class="flex flex-col justify-center items-center w-full h-full bg-gray-100/90 p-4">
94
- <div class="w-full flex justify-end">
95
- <button class="js-close-popup w-auto m-4 p-2 bg-white rounded transition-transform hover:scale-125 cursor-pointer">X</button>
96
- </div>
97
- <div class="w-full h-full flex items-center justify-center">
98
- <iframe
99
- class="rounded-xl shadow-lg max-w-full md:max-w-3/4 aspect-video"
100
- src=""
101
- frameborder="0"
102
- allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
103
- allowfullscreen=""></iframe>
104
- </div>
105
- </div>
106
- </div>
107
-
108
- <script is:inline define:vars={{ randomId }}>
109
-
110
- const iframePopup = document.getElementById(`popup-iframe-modal-${randomId}`);
111
- document.querySelectorAll(`.popup-iframe-trigger-${randomId}`).forEach(btn => {
112
- btn.addEventListener('click', (e) => {
113
- const iframeSrc = btn.getAttribute('data-iframesrc');
114
- iframePopup.classList.remove('hidden');
115
- iframePopup.querySelector('iframe').setAttribute('src', iframeSrc);
116
- });
117
- });
118
-
119
- iframePopup.querySelector('.js-close-popup').addEventListener('click', () => {
120
- iframePopup.classList.add('hidden');
121
- iframePopup.querySelector('iframe').setAttribute('src', '');
122
- });
123
-
124
- </script>
125
-
126
-
127
- <script is:inline define:vars={{carouselId, buttonsId, prevId, nextId, slidesToShow, slidesToScroll}}>
128
- document.addEventListener('DOMContentLoaded', function() {
129
-
130
- new Glider(document.querySelector('#' + carouselId), {
131
-
132
- // `auto` allows automatic responsive
133
- // width calculations
134
- slidesToShow: slidesToShow,
135
- slidesToScroll: '1',
136
-
137
- // should have been named `itemMinWidth`
138
- // slides grow to fit the container viewport
139
- // ignored unless `slidesToShow` is set to `auto`
140
- itemWidth: undefined,
141
-
142
- // if true, slides wont be resized to fit viewport
143
- // requires `itemWidth` to be set
144
- // * this may cause fractional slides
145
- exactWidth: false,
146
-
147
- // speed aggravator - higher is slower
148
- duration: .5,
149
-
150
- // dot container element or selector
151
- dots: '#' + buttonsId,
152
-
153
- // arrow container elements or selector
154
- arrows: {
155
- prev: '#' + prevId,
156
- // may also pass element directly
157
- next: '#' + nextId
158
- },
159
-
160
- // allow mouse dragging
161
- draggable: true,
162
- // how much to scroll with each mouse delta
163
- dragVelocity: 3.3,
164
-
165
- // use any custom easing function
166
- // compatible with most easing plugins
167
- easing: function (x, t, b, c, d) {
168
- return c*(t/=d)*t + b;
169
- },
170
-
171
- // event control
172
- scrollPropagate: false,
173
- eventPropagate: true,
174
-
175
- // Force centering slide after scroll event
176
- scrollLock: false,
177
- // how long to wait after scroll event before locking
178
- // if too low, it might interrupt normal scrolling
179
- scrollLockDelay: 150,
180
-
181
- // Force centering slide after resize event
182
- resizeLock: true,
183
-
184
- // Glider.js breakpoints are mobile-first
185
- responsive: [
186
- {
187
- breakpoint: 1400,
188
- settings: {
189
- slidesToShow: slidesToShow,
190
- slidesToScroll: 1
191
- }
192
- },
193
- {
194
- breakpoint: 1200,
195
- settings: {
196
- slidesToShow: (slidesToShow >= 5)? slidesToShow - 1 : slidesToShow,
197
- slidesToScroll: 1
198
- }
199
- },
200
- {
201
- breakpoint: 900,
202
- settings: {
203
- slidesToShow: 3,
204
- slidesToScroll: 1
205
- }
206
- },
207
- {
208
- breakpoint: 767,
209
- settings: {
210
- slidesToShow: 3,
211
- slidesToScroll: 3
212
- }
213
- },
214
- {
215
- breakpoint: 575,
216
- settings: {
217
- slidesToShow: 2,
218
- slidesToScroll: 1
219
- }
220
- },
221
- {
222
- breakpoint: 0,
223
- settings: {
224
- slidesToShow: 1,
225
- slidesToScroll: 1
226
- }
227
- }
228
- ]
229
- });
230
-
231
- });
232
- </script>
233
-
234
- <Fragment set:html={structuredData} />
235
-
1
+ ---
2
+ const {
3
+ loadScript = true,
4
+ items,
5
+ slidesToShow = 5,
6
+ slidesToScroll = 1,
7
+ } = Astro.props;
8
+
9
+ const carouselId = "glider-carousel-"+Math.floor(Math.random()*1000);
10
+ const buttonsId = "glider-carousel-buttons-"+Math.floor(Math.random()*1000);
11
+ const prevId = "glider-carousel-prev-"+Math.floor(Math.random()*1000);
12
+ const nextId = "glider-carousel-next-"+Math.floor(Math.random()*1000);
13
+
14
+ const randomId = Math.floor(Math.random() * 1000);
15
+
16
+ const structuredData = `<script type="application/ld+json">
17
+ {
18
+ "@context": "https://schema.org",
19
+ "@type": "ItemList",
20
+ "name": "Carousel Items",
21
+ "itemListElement": [
22
+ ${items.map((item, index) => `{
23
+ "@type": "ListItem",
24
+ "position": ${index + 1},
25
+ "item": {
26
+ "@type": "${item.iframeSrc ? 'VideoObject' : 'ImageObject'}",
27
+ ${item.iframeSrc ? `
28
+ "name": "${item.description ? item.description.replace(/"/g, '\\"') : ''}",
29
+ "description": "${item.description ? item.description.replace(/"/g, '\\"') : ''}",
30
+ "thumbnailUrl": "${item.thumbnailUrl}",
31
+ "embedUrl": "${item.iframeSrc}",
32
+ "uploadDate": "${item.uploadDate}",
33
+ "author": {
34
+ "@type": "Person",
35
+ "name": "${item.author ? item.author.replace(/"/g, '\\"') : ''}",
36
+ "jobTitle": "${item.positionCompany ? item.positionCompany.replace(/"/g, '\\"') : ''}"
37
+ }` : `
38
+ "contentUrl": "${item.image}",
39
+ "name": "${item.altImage ? item.altImage.replace(/"/g, '\\"') : ''}",
40
+ "description": "${item.descriptionImage ? item.descriptionImage.replace(/"/g, '\\"') : ''}"`}
41
+ }
42
+ }`).join(',')}
43
+ ]
44
+ }
45
+ </script>`;
46
+
47
+ ---
48
+
49
+ {loadScript &&
50
+ <div>
51
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/glider-js@1/glider.min.css"/>
52
+ <script src="https://cdn.jsdelivr.net/npm/glider-js@1/glider.min.js"></script>
53
+ </div>
54
+ }
55
+
56
+ <style is:global>
57
+ .glider-track{
58
+ display: flex;
59
+ align-items: start !important;
60
+ }
61
+ .glider-dots {
62
+ display: none !important;
63
+ }
64
+ </style>
65
+
66
+ <div class="w-full ">
67
+ <div id={carouselId} class="glider w-full">
68
+ {items.map((item, idx) => (
69
+ <div class="flex flex-col items-center p-10 bg-white">
70
+ {item.iframeSrc ? (
71
+ <div class="w-full">
72
+ <span class={`popup-iframe-trigger-${randomId} cursor-pointer`} data-iframesrc={item.iframeSrc}>
73
+ <img src={item.imageSrc} class="w-full h-full rounded-2xl p-2 transition-transform hover:scale-105 cursor-pointer"/>
74
+ </span>
75
+ </div>
76
+ <div class="p-6 flex-grow flex flex-col">
77
+ <div class="mt-2 flex items-center gap-2 flex-grow">
78
+ <div class="flex flex-col text-[#262626] h-full">
79
+ <p class="text-base font-inter font-normal leading-[24px] mb-[24px]">{item.description}</p>
80
+ <p class="text-[14px] font-semibold leading-[20px]">{item.author}<br />{item.positionCompany}</p>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ ) : (
85
+ <img src={item.image} alt={item.altImage} class="!max-w-[250px] w-fit" />
86
+ <p>{item.descriptionImage}</p>
87
+ )}
88
+ </div>
89
+ ))}
90
+ </div>
91
+ <div id={buttonsId} class="carouselGlider hidden md:flex"></div>
92
+ </div>
93
+
94
+ <div id={"popup-iframe-modal-" + randomId } class="fixed w-full h-full top-0 left-0 z-9999 hidden">
95
+ <div class="flex flex-col justify-center items-center w-full h-full bg-gray-100/90 p-4">
96
+ <div class="w-full flex justify-end">
97
+ <button class="js-close-popup w-auto m-4 p-2 bg-white rounded transition-transform hover:scale-125 cursor-pointer">X</button>
98
+ </div>
99
+ <div class="w-full h-full flex items-center justify-center">
100
+ <iframe
101
+ class="rounded-xl shadow-lg max-w-full md:max-w-3/4 aspect-video"
102
+ src=""
103
+ frameborder="0"
104
+ allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
105
+ allowfullscreen=""></iframe>
106
+ </div>
107
+ </div>
108
+ </div>
109
+
110
+ <script is:inline define:vars={{ randomId }}>
111
+
112
+ const iframePopup = document.getElementById(`popup-iframe-modal-${randomId}`);
113
+ document.querySelectorAll(`.popup-iframe-trigger-${randomId}`).forEach(btn => {
114
+ btn.addEventListener('click', (e) => {
115
+ const iframeSrc = btn.getAttribute('data-iframesrc');
116
+ iframePopup.classList.remove('hidden');
117
+ iframePopup.querySelector('iframe').setAttribute('src', iframeSrc);
118
+ });
119
+ });
120
+
121
+ iframePopup.querySelector('.js-close-popup').addEventListener('click', () => {
122
+ iframePopup.classList.add('hidden');
123
+ iframePopup.querySelector('iframe').setAttribute('src', '');
124
+ });
125
+
126
+ </script>
127
+
128
+
129
+ <script is:inline define:vars={{carouselId, buttonsId, prevId, nextId, slidesToShow, slidesToScroll}}>
130
+ document.addEventListener('DOMContentLoaded', function() {
131
+
132
+ new Glider(document.querySelector('#' + carouselId), {
133
+
134
+ // `auto` allows automatic responsive
135
+ // width calculations
136
+ slidesToShow: slidesToShow,
137
+ slidesToScroll: '1',
138
+
139
+ // should have been named `itemMinWidth`
140
+ // slides grow to fit the container viewport
141
+ // ignored unless `slidesToShow` is set to `auto`
142
+ itemWidth: undefined,
143
+
144
+ // if true, slides wont be resized to fit viewport
145
+ // requires `itemWidth` to be set
146
+ // * this may cause fractional slides
147
+ exactWidth: false,
148
+
149
+ // speed aggravator - higher is slower
150
+ duration: .5,
151
+
152
+ // dot container element or selector
153
+ dots: '#' + buttonsId,
154
+
155
+ // arrow container elements or selector
156
+ arrows: {
157
+ prev: '#' + prevId,
158
+ // may also pass element directly
159
+ next: '#' + nextId
160
+ },
161
+
162
+ // allow mouse dragging
163
+ draggable: true,
164
+ // how much to scroll with each mouse delta
165
+ dragVelocity: 3.3,
166
+
167
+ // use any custom easing function
168
+ // compatible with most easing plugins
169
+ easing: function (x, t, b, c, d) {
170
+ return c*(t/=d)*t + b;
171
+ },
172
+
173
+ // event control
174
+ scrollPropagate: false,
175
+ eventPropagate: true,
176
+
177
+ // Force centering slide after scroll event
178
+ scrollLock: false,
179
+ // how long to wait after scroll event before locking
180
+ // if too low, it might interrupt normal scrolling
181
+ scrollLockDelay: 150,
182
+
183
+ // Force centering slide after resize event
184
+ resizeLock: true,
185
+
186
+ // Glider.js breakpoints are mobile-first
187
+ responsive: [
188
+ {
189
+ breakpoint: 1400,
190
+ settings: {
191
+ slidesToShow: slidesToShow,
192
+ slidesToScroll: 1
193
+ }
194
+ },
195
+ {
196
+ breakpoint: 1200,
197
+ settings: {
198
+ slidesToShow: (slidesToShow >= 5)? slidesToShow - 1 : slidesToShow,
199
+ slidesToScroll: 1
200
+ }
201
+ },
202
+ {
203
+ breakpoint: 900,
204
+ settings: {
205
+ slidesToShow: 3,
206
+ slidesToScroll: 1
207
+ }
208
+ },
209
+ {
210
+ breakpoint: 767,
211
+ settings: {
212
+ slidesToShow: 3,
213
+ slidesToScroll: 3
214
+ }
215
+ },
216
+ {
217
+ breakpoint: 575,
218
+ settings: {
219
+ slidesToShow: 2,
220
+ slidesToScroll: 1
221
+ }
222
+ },
223
+ {
224
+ breakpoint: 0,
225
+ settings: {
226
+ slidesToShow: 1,
227
+ slidesToScroll: 1
228
+ }
229
+ }
230
+ ]
231
+ });
232
+
233
+ });
234
+ </script>
235
+
236
+ <Fragment set:html={structuredData} />
237
+
@@ -29,7 +29,6 @@ const structuredData = `<script type="application/ld+json">
29
29
  "contentUrl": "${item.iframeSrc || ''}",
30
30
  "embedUrl": "${item.iframeSrc || ''}",
31
31
  "uploadDate": "${new Date().toISOString()}",
32
- "duration": "PT0M",
33
32
  "interactionStatistic": {
34
33
  "@type": "InteractionCounter",
35
34
  "interactionType": "https://schema.org/WatchAction",
@@ -29,7 +29,6 @@ const structuredData = `<script type="application/ld+json">
29
29
  "contentUrl": "${item.iframeSrc || ''}",
30
30
  "embedUrl": "${item.iframeSrc || ''}",
31
31
  "uploadDate": "${new Date().toISOString()}",
32
- "duration": "PT0M",
33
32
  "interactionStatistic": {
34
33
  "@type": "InteractionCounter",
35
34
  "interactionType": "https://schema.org/WatchAction",