@tekkare/romulus 0.1.150 → 0.1.151

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/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
- "version": "0.1.149",
7
+ "version": "0.1.150",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "0.8.4",
10
10
  "unbuild": "2.0.0"
@@ -396,6 +396,10 @@ function submit() {
396
396
  </script>
397
397
 
398
398
  <template>
399
+ <!-- Chaque section porte un `data-field` : les sections partagent la meme
400
+ classe, et une visite guidee (cf. RmTour) doit pouvoir designer
401
+ « Declencheurs » sans compter les fieldsets, dont le nombre change
402
+ avec le genre d'alerte. -->
399
403
  <form class="rm-alert-form" @submit.prevent="submit">
400
404
  <RmInput
401
405
  :model-value="title"
@@ -407,7 +411,7 @@ function submit() {
407
411
  "
408
412
  />
409
413
 
410
- <fieldset v-if="!editing && canWatchView" class="rm-alert-form__group">
414
+ <fieldset v-if="!editing && canWatchView" class="rm-alert-form__group" data-field="kind">
411
415
  <legend class="rm-alert-form__label">{{ T.kind }}</legend>
412
416
  <p class="rm-alert-form__hint">
413
417
  {{
@@ -427,7 +431,7 @@ function submit() {
427
431
  />
428
432
  </fieldset>
429
433
 
430
- <fieldset v-if="watchesProduct" class="rm-alert-form__group">
434
+ <fieldset v-if="watchesProduct" class="rm-alert-form__group" data-field="brands">
431
435
  <legend class="rm-alert-form__label">{{ T.brands }}</legend>
432
436
  <p class="rm-alert-form__hint">{{ T.brandsHint }}</p>
433
437
  <!-- L'intitule du filtre dit l'action, pas le titre de la section :
@@ -457,7 +461,7 @@ function submit() {
457
461
  </p>
458
462
  </fieldset>
459
463
 
460
- <div v-else-if="!editing" class="rm-alert-form__view">
464
+ <div v-else-if="!editing" class="rm-alert-form__view" data-field="view">
461
465
  <p class="rm-alert-form__label">{{ T.view }}</p>
462
466
  <p class="rm-alert-form__hint">
463
467
  <!-- L'avertissement sur l'application ne vaut que pour une vue deja
@@ -491,7 +495,7 @@ function submit() {
491
495
  {{ watchesProduct ? `${T.brands} : ${brands.join(', ')}` : `${T.view} : ${viewTitle}` }}
492
496
  </p>
493
497
 
494
- <fieldset class="rm-alert-form__group">
498
+ <fieldset class="rm-alert-form__group" data-field="triggers">
495
499
  <legend class="rm-alert-form__label">{{ T.triggers }}</legend>
496
500
  <p class="rm-alert-form__hint">{{ T.triggersHint }}</p>
497
501
  <RmCheckbox
@@ -512,7 +516,7 @@ function submit() {
512
516
  {{ T.productFields }}
513
517
  </p>
514
518
 
515
- <fieldset v-if="watchesChanges && !watchesProduct" class="rm-alert-form__group">
519
+ <fieldset v-if="watchesChanges && !watchesProduct" class="rm-alert-form__group" data-field="fields">
516
520
  <legend class="rm-alert-form__label">{{ T.fields }}</legend>
517
521
  <p class="rm-alert-form__hint">{{ anyField ? T.anyFieldHint : T.fieldsHint }}</p>
518
522
  <template v-if="fields.length">
@@ -530,7 +534,7 @@ function submit() {
530
534
  <p v-else class="rm-alert-form__hint">{{ T.noFields }}</p>
531
535
  </fieldset>
532
536
 
533
- <fieldset class="rm-alert-form__group">
537
+ <fieldset class="rm-alert-form__group" data-field="channels">
534
538
  <legend class="rm-alert-form__label">{{ T.channels }}</legend>
535
539
  <RmCheckbox :model-value="true" :label="T.inApp" disabled />
536
540
 
@@ -152,15 +152,44 @@ function stop() {
152
152
  frame = null
153
153
  }
154
154
 
155
- /** La cible est amenee a l'ecran au changement d'etape, jamais apres. */
155
+ /**
156
+ * La cible est amenee a l'ecran au changement d'etape, jamais apres.
157
+ *
158
+ * Le defilement est VERTICAL seulement, et fait a la main plutot que par
159
+ * `scrollIntoView`. Une cible du cadre (un panneau qui glisse encore, une
160
+ * tuile du rail) est brievement hors champ a droite, et `scrollIntoView` y
161
+ * repond en poussant la page de cote : le cadre se decalait, et le detourage
162
+ * pointait a cote pour tout le reste de la visite.
163
+ */
156
164
  function reveal() {
157
165
  const selector = current.value?.target
158
166
  if (!selector) return
159
167
  const node = findTarget(selector)
160
168
  if (!node) return
169
+
170
+ const rect = node.getBoundingClientRect()
171
+ const vh = window.innerHeight
172
+ // Deja lisible : ne rien bouger. Une cible plus haute que la fenetre compte
173
+ // comme lue des que son debut est visible.
174
+ if (rect.top >= 0 && (rect.bottom <= vh || rect.height >= vh)) return
175
+
161
176
  const still = document.body.classList.contains('reduce-motion')
162
177
  || window.matchMedia('(prefers-reduced-motion: reduce)').matches
163
- node.scrollIntoView({ block: 'center', inline: 'nearest', behavior: still ? 'auto' : 'smooth' })
178
+ const delta = rect.top - Math.max((vh - rect.height) / 2, 0)
179
+
180
+ // Le conteneur qui defile : le corps d'un panneau ou d'une modale, sinon la
181
+ // fenetre. Sans cette recherche, une etape qui designe le bas d'un
182
+ // formulaire long ferait defiler la page derriere la modale.
183
+ let parent: HTMLElement | null = node.parentElement
184
+ while (parent) {
185
+ const style = getComputedStyle(parent)
186
+ const scrolls = /(auto|scroll)/.test(style.overflowY)
187
+ if (scrolls && parent.scrollHeight > parent.clientHeight + 1) break
188
+ parent = parent.parentElement
189
+ }
190
+
191
+ if (parent) parent.scrollBy({ top: delta, behavior: still ? 'auto' : 'smooth' })
192
+ else window.scrollBy({ top: delta, behavior: still ? 'auto' : 'smooth' })
164
193
  }
165
194
 
166
195
  function onKeydown(event: KeyboardEvent) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tekkare/romulus",
3
- "version": "0.1.150",
3
+ "version": "0.1.151",
4
4
  "description": "Romulus Design System - Nuxt module by Tekkare",
5
5
  "license": "MIT",
6
6
  "type": "module",