@rocketsearch/nuxt-uappi 0.2.1 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rocketsearch/nuxt-uappi",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "Rocket Search para storefronts Uappi (Nuxt 2): busca, autocomplete, vitrines, banners e eventos",
5
5
  "main": "module.js",
6
6
  "files": [
@@ -1,5 +1,8 @@
1
1
  <template>
2
- <div class="rocket-search rocket-search__banner-slot" :data-rocket-banner-position="position">
2
+ <div
3
+ :class="['rocket-search', 'rocket-search__banner-slot', { 'rocket-search--empty': !waiting && !banners.length }]"
4
+ :data-rocket-banner-position="position"
5
+ >
3
6
  <!-- Skeleton só com proporção declarada: sem saber a altura, ele é que causaria o pulo. -->
4
7
  <div v-if="waiting && ratio" class="rocket-search__banner-skeleton" :style="{ aspectRatio: ratioCss }" aria-hidden="true" />
5
8
 
@@ -1,5 +1,9 @@
1
1
  <template>
2
- <div v-if="showcase || loading" class="rocket-search" :data-rocket-showcase-position="position">
2
+ <div
3
+ v-if="showcase || loading || debug"
4
+ :class="['rocket-search', { 'rocket-search--empty': !showcase && !loading }]"
5
+ :data-rocket-showcase-position="position"
6
+ >
3
7
  <div v-if="loading" class="rocket-search__showcase rocket-search__showcase--skeleton" :style="columnsStyle">
4
8
  <div class="rocket-search__showcase__title rocket-search__product-placeholder__item" />
5
9
  <div class="rocket-search__product-placeholder">
@@ -13,7 +17,7 @@
13
17
  <RocketBannerItem v-else-if="bannerOnly" :item="showcase" :position="position" />
14
18
 
15
19
  <section
16
- v-else
20
+ v-else-if="showcase"
17
21
  ref="root"
18
22
  class="rocket-search__showcase"
19
23
  :data-rocket-showcase-id="showcase.id"
@@ -62,7 +66,7 @@ export default {
62
66
  mediaSize: { type: String, default: 'medium' }
63
67
  },
64
68
  data () {
65
- return { showcase: null, products: [], loading: false };
69
+ return { showcase: null, products: [], loading: false, debug: false };
66
70
  },
67
71
  computed: {
68
72
  columns () {
@@ -88,6 +92,9 @@ export default {
88
92
  }
89
93
  },
90
94
  mounted () {
95
+ // ?rocket-search-debug=true: o slot aparece mesmo vazio. Lido no mounted (não no data)
96
+ // para o HTML do SSR bater com a hidratação.
97
+ this.debug = document.body.classList.contains('rocket-search-debug');
91
98
  if (this.pageType || this.$rocket.getPage().section) this.load();
92
99
  },
93
100
  beforeDestroy () {
@@ -93,63 +93,116 @@
93
93
  }
94
94
  }
95
95
 
96
- /* DEBUG: ?rocket-search-debug=true contorna e rotula cada slot de vitrine/banner. */
96
+ /* DEBUG: ?rocket-search-debug=true contorna e rotula toda posição de vitrine e de banner —
97
+ inclusive as vazias (o RocketShowcase só as renderiza no debug; o slot do RocketBanner
98
+ existe sempre e sem altura). Mesmo layout da Linx 2.0.0. */
97
99
  body.rocket-search-debug {
98
- & [data-rocket-showcase-position] {
100
+ & [data-rocket-showcase-position],
101
+ & [data-rocket-banner-position] {
102
+ --color: #64748b;
103
+ --content: attr(data-rocket-showcase-position);
99
104
  position: relative;
100
- border: 2px solid var(--color);
101
- padding: 60px 15px;
102
-
103
- &::before,
104
- &::after {
105
+ min-height: 140px;
106
+ padding: 52px 16px 16px;
107
+ border: 2px dashed var(--color);
108
+ border-radius: 12px;
109
+ overflow: hidden;
110
+ background-color: color-mix(in srgb, var(--color) 6%, transparent);
111
+
112
+ /* Selo com o nome da posição */
113
+ &::before {
105
114
  content: var(--content);
106
115
  position: absolute;
107
- left: 50%;
108
- width: fit-content;
109
- margin: 0 auto;
110
- padding: 0 5px;
116
+ top: 12px;
117
+ left: 12px;
118
+ padding: 5px 12px;
119
+ border-radius: 999px;
120
+ color: #fff;
121
+ background-color: var(--color);
122
+ font: 700 12px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
123
+ letter-spacing: 0.06em;
124
+ text-transform: uppercase;
125
+ z-index: 2;
126
+ }
127
+
128
+ /* Atributo do slot, para quem vai mexer no template */
129
+ &::after {
130
+ content: "data-rocket-showcase-position=\"" attr(data-rocket-showcase-position) "\"";
131
+ position: absolute;
132
+ top: 16px;
133
+ right: 14px;
111
134
  color: var(--color);
112
- display: block;
113
- font-size: 18px;
114
- font-weight: 700;
115
- text-align: center;
116
- background-color: #f6f6f6;
117
- z-index: 1;
135
+ font: 500 11px/1.2 ui-monospace, Consolas, monospace;
136
+ opacity: 0.8;
137
+ z-index: 2;
118
138
  }
119
139
 
120
- &::before {
121
- top: 0;
122
- transform: translate(-50%, -50%);
140
+ /* Posição sem vitrine/banner */
141
+ &.rocket-search--empty::before {
142
+ content: var(--content) " · vazia";
123
143
  }
124
144
 
125
- &::after {
126
- bottom: 0;
127
- transform: translate(-50%, 50%);
145
+ &[data-rocket-banner-position] {
146
+ --content: attr(data-rocket-banner-position);
147
+
148
+ &::after {
149
+ content: "data-rocket-banner-position=\"" attr(data-rocket-banner-position) "\"";
150
+ }
128
151
  }
129
152
 
130
153
  &[data-rocket-showcase-position="hero"] {
131
- --color: lab(52.0183% 66.11 -78.2316);
154
+ --color: #7c3aed;
132
155
  --content: "Hero";
133
156
  }
134
157
 
135
158
  &[data-rocket-showcase-position="top"] {
136
- --color: lab(70.5521% -66.5147 45.8073);
159
+ --color: #059669;
137
160
  --content: "Topo";
138
161
  }
139
162
 
140
163
  &[data-rocket-showcase-position="middle"] {
141
- --color: lab(64.272% 57.1788 90.3583);
164
+ --color: #d97706;
142
165
  --content: "Meio";
143
166
  }
144
167
 
145
168
  &[data-rocket-showcase-position="bottom"] {
146
- --color: lab(55.4814% 75.0732 48.8528);
147
- --content: "Rodape";
169
+ --color: #dc2626;
170
+ --content: "Rodapé";
148
171
  }
149
172
 
150
173
  &[data-rocket-showcase-position="prefooter"] {
151
- --color: lab(48.295% 38.3129 -81.9673);
152
- --content: "Antes do Footer";
174
+ --color: #2563eb;
175
+ --content: "Antes do footer";
176
+ }
177
+
178
+ &[data-rocket-banner-position="fullbanner"] {
179
+ --color: #db2777;
180
+ --content: "Fullbanner";
181
+ }
182
+
183
+ &[data-rocket-banner-position="menu"] {
184
+ --color: #0891b2;
185
+ --content: "Menu";
186
+ }
187
+
188
+ &[data-rocket-banner-position="category"] {
189
+ --color: #65a30d;
190
+ --content: "Categoria";
191
+ }
192
+
193
+ &[data-rocket-banner-position="mosaic"] {
194
+ --color: #9333ea;
195
+ --content: "Grade";
196
+ }
197
+
198
+ &[data-rocket-banner-position="strip"] {
199
+ --color: #ea580c;
200
+ --content: "Faixa";
201
+ }
202
+
203
+ &[data-rocket-banner-position="footer"] {
204
+ --color: #4f46e5;
205
+ --content: "Antes do rodapé";
153
206
  }
154
207
  }
155
208
  }