@directo-ui/astro 1.1.0 → 1.2.0

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,84 @@
1
+ ---
2
+ interface Props {
3
+ /** `{ name, phone }` inicial. */
4
+ value?: { name?: string; phone?: string };
5
+ /** Barra de carga al cargar la página. En el cliente, activa o quita `aria-busy="true"` en el grupo. */
6
+ loading?: boolean;
7
+ loadingLabel?: string;
8
+ label?: string;
9
+ namePlaceholder?: string;
10
+ phonePlaceholder?: string;
11
+ nameLabel?: string;
12
+ phoneLabel?: string;
13
+ clearLabel?: string;
14
+ showClear?: boolean;
15
+ /** Nombres de los campos al enviar un formulario. */
16
+ nameInputName?: string;
17
+ phoneInputName?: string;
18
+ disabled?: boolean;
19
+ id?: string;
20
+ class?: string;
21
+ }
22
+
23
+ const {
24
+ value = {}, loading = false, loadingLabel = 'Buscando pasajero…', label = 'Pasajero', namePlaceholder = 'Nombre del pasajero',
25
+ phonePlaceholder = 'Ingresa el número del pasajero', nameLabel = 'Nombre del pasajero', phoneLabel = 'Número del pasajero',
26
+ clearLabel = 'Quitar pasajero', showClear = true, nameInputName, phoneInputName, disabled = false, id, class: className,
27
+ } = Astro.props;
28
+ const name = value.name ?? '';
29
+ const phone = value.phone ?? '';
30
+ const phonePath = 'M5 3.5h3.2l1.6 4-2 1.3a10.5 10.5 0 0 0 5.4 5.4l1.3-2 4 1.6V17a2 2 0 0 1-2 2A15.5 15.5 0 0 1 3 5.5a2 2 0 0 1 2-2Z';
31
+ ---
32
+ <div id={id} class:list={['ds-wpassenger', className]} role="group" aria-label={label} aria-busy={loading ? 'true' : undefined} data-ds-wpassenger>
33
+ <div class="ds-wpassenger-row">
34
+ <label class="ds-wpassenger-field">
35
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="8" r="3.5"/><path d="M5 20c.8-3.5 3.6-5.5 7-5.5s6.2 2 7 5.5"/></svg>
36
+ <input class="ds-wpassenger-input" type="text" autocomplete="name" name={nameInputName} placeholder={namePlaceholder} aria-label={nameLabel}
37
+ value={name} disabled={disabled} data-field="name" />
38
+ </label>
39
+ <label class="ds-wpassenger-field">
40
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-icon="empty" hidden={phone !== ''}><path d={phonePath}/></svg>
41
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true" data-icon="filled" hidden={phone === ''}><path d={phonePath}/><path d="M15 4h5M15 7h5M17 10h3"/></svg>
42
+ <input class="ds-wpassenger-input" type="tel" autocomplete="tel" inputmode="tel" name={phoneInputName} placeholder={phonePlaceholder} aria-label={phoneLabel}
43
+ value={phone} disabled={disabled} data-field="phone" />
44
+ </label>
45
+ {showClear && <button type="button" class="ds-wpassenger-clear" aria-label={clearLabel} title={clearLabel} disabled={disabled} data-ds-clear>
46
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke-linecap="round" aria-hidden="true"><circle cx="12" cy="12" r="9.5" fill="currentColor"/><path d="m9 9 6 6M15 9l-6 6" stroke="#fff" stroke-width="2"/></svg>
47
+ </button>}
48
+ </div>
49
+ <div class="ds-wclient-progress ds-wpassenger-progress" role="progressbar" aria-label={loadingLabel} data-ds-progress></div>
50
+ </div>
51
+
52
+ <script>
53
+ // Emits on the group: "ds-change" ({ name, phone } en cada tecla) and "ds-clear" (botón ⓧ, después de vaciar los campos).
54
+ // Carga: group.setAttribute('aria-busy', 'true') / removeAttribute('aria-busy'). Valor desde tu código: group.dsSetValue({ name, phone }).
55
+ type PassengerRoot = HTMLElement & { dsSetValue?: (value: { name?: string; phone?: string }) => void };
56
+ function initPassengerFields() {
57
+ document.querySelectorAll<PassengerRoot>('[data-ds-wpassenger]:not([data-ds-ready])').forEach(root => {
58
+ root.dataset.dsReady = '';
59
+ const name = root.querySelector<HTMLInputElement>('[data-field="name"]')!;
60
+ const phone = root.querySelector<HTMLInputElement>('[data-field="phone"]')!;
61
+ const read = () => ({ name: name.value, phone: phone.value });
62
+ const syncIcon = () => {
63
+ root.querySelector<SVGElement>('[data-icon="empty"]')?.toggleAttribute('hidden', phone.value !== '');
64
+ root.querySelector<SVGElement>('[data-icon="filled"]')?.toggleAttribute('hidden', phone.value === '');
65
+ };
66
+ const emit = (type: string, detail?: unknown) => root.dispatchEvent(new CustomEvent(type, { detail, bubbles: true }));
67
+ for (const input of [name, phone]) input.addEventListener('input', () => { syncIcon(); emit('ds-change', read()); });
68
+ root.querySelector('[data-ds-clear]')?.addEventListener('click', () => {
69
+ name.value = '';
70
+ phone.value = '';
71
+ syncIcon();
72
+ emit('ds-change', read());
73
+ emit('ds-clear');
74
+ });
75
+ root.dsSetValue = value => {
76
+ name.value = value.name ?? '';
77
+ phone.value = value.phone ?? '';
78
+ syncIcon();
79
+ };
80
+ });
81
+ }
82
+ initPassengerFields();
83
+ document.addEventListener('astro:page-load', initPassengerFields);
84
+ </script>
@@ -0,0 +1,49 @@
1
+ ---
2
+ import { routeHtml } from '../wari/route-client.js';
3
+ import { normalizeRoute } from '../wari/route.js';
4
+ import type { WariRouteValue } from '../wari/route';
5
+
6
+ interface Props {
7
+ /** Ruta inicial: { stops, passenger, tolls }. Sin valor: origen, un destino y un peaje vacío. */
8
+ value?: Partial<WariRouteValue>;
9
+ title?: string;
10
+ headingLevel?: 2 | 3 | 4;
11
+ maxStops?: number;
12
+ maxTolls?: number;
13
+ showPassengers?: boolean;
14
+ showTolls?: boolean;
15
+ /** Envía la ruta como JSON en un campo oculto con este nombre. */
16
+ name?: string;
17
+ /** Simula "Invirtiendo direcciones..." durante estos milisegundos (para maquetas). En tu app pon aria-busy="true". */
18
+ invertDelay?: number;
19
+ invertingLabel?: string;
20
+ invertedMessage?: string;
21
+ routePassengerNote?: string;
22
+ disabled?: boolean;
23
+ class?: string;
24
+ id?: string;
25
+ }
26
+
27
+ const {
28
+ value, title = 'Ruta', headingLevel = 3, maxStops = 10, maxTolls = 5, showPassengers = true, showTolls = true, name, invertDelay,
29
+ invertingLabel, invertedMessage, routePassengerNote, disabled = false, class: className, id,
30
+ } = Astro.props;
31
+ const baseId = `ds-wroute-${Math.random().toString(36).slice(2, 9)}`;
32
+ const route = normalizeRoute(value);
33
+ const options = { title, headingLevel, maxStops, maxTolls, showPassengers, showTolls, disabled, invertingLabel, invertedMessage, routePassengerNote };
34
+ const definedOptions = Object.fromEntries(Object.entries(options).filter(([, v]) => v !== undefined));
35
+ ---
36
+ <section id={id} class:list={['ds-wcard', 'ds-wroute', className]} data-ds-wroute aria-labelledby={`${baseId}-title`} data-base-id={baseId}
37
+ data-value={JSON.stringify(route)} data-title={title} data-heading-level={headingLevel} data-max-stops={maxStops} data-max-tolls={maxTolls}
38
+ data-show-passengers={String(showPassengers)} data-show-tolls={String(showTolls)} data-disabled={String(disabled)}
39
+ data-invert-delay={invertDelay} data-inverting-label={invertingLabel} data-inverted-message={invertedMessage}
40
+ data-route-passenger-note={routePassengerNote}>
41
+ {name && <input type="hidden" name={name} value={JSON.stringify(route)} data-ds-value />}
42
+ <div data-ds-route-content style="display:contents" set:html={routeHtml(route, definedOptions, baseId)} />
43
+ </section>
44
+
45
+ <script>
46
+ import { initWariRoute } from '../wari/route-client.js';
47
+ initWariRoute();
48
+ document.addEventListener('astro:page-load', () => initWariRoute());
49
+ </script>
@@ -3,6 +3,10 @@ import { clampCount } from '../wari/trip.js';
3
3
 
4
4
  interface Props {
5
5
  label?: string;
6
+ /** Nombre accesible cuando no hay `label` visible. */
7
+ ariaLabel?: string;
8
+ /** 'outlined': botones con borde y más alto, como el contador del Booster en Figma. */
9
+ variant?: 'filled' | 'outlined';
6
10
  value?: number;
7
11
  min?: number;
8
12
  max?: number;
@@ -11,21 +15,22 @@ interface Props {
11
15
  id?: string;
12
16
  disabled?: boolean;
13
17
  class?: string;
18
+ [attribute: `data-${string}`]: unknown;
14
19
  }
15
20
 
16
- const { label, value = 1, min = 1, max = 99, name, disabled = false, class: className } = Astro.props;
21
+ const { label, ariaLabel, variant = 'filled', value = 1, min = 1, max = 99, name, disabled = false, class: className, id: _id, ...rest } = Astro.props;
17
22
  const id = Astro.props.id ?? `ds-wstepper-${Math.random().toString(36).slice(2, 9)}`;
18
23
  const current = clampCount(value, min, max);
19
- const subject = label ? label.toLowerCase() : 'cantidad';
24
+ const subject = (label ?? ariaLabel ?? 'cantidad').toLowerCase();
20
25
  ---
21
26
  <div class:list={['ds-input', 'ds-wfield', 'ds-wstepper', className]} data-ds-wstepper data-min={min} data-max={max}
22
- data-disabled={String(disabled)} data-label="lg">
27
+ data-disabled={String(disabled)} data-label="lg" data-variant={variant} {...rest}>
23
28
  {label && <label for={id}>{label}</label>}
24
29
  <div class="ds-input-shell">
25
30
  <button type="button" class="ds-wstepper-button" aria-label={`Disminuir ${subject}`} aria-controls={id} disabled={disabled || current <= min}>
26
31
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="M5 12h14"/></svg>
27
32
  </button>
28
- <input id={id} type="text" inputmode="numeric" role="spinbutton" name={name} value={String(current)} disabled={disabled}
33
+ <input id={id} type="text" inputmode="numeric" role="spinbutton" name={name} value={String(current)} disabled={disabled} aria-label={label ? undefined : ariaLabel}
29
34
  aria-valuenow={current} aria-valuemin={min} aria-valuemax={max} />
30
35
  <button type="button" class="ds-wstepper-button" aria-label={`Aumentar ${subject}`} aria-controls={id} disabled={disabled || current >= max}>
31
36
  <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>
@@ -1,29 +1,107 @@
1
1
  ---
2
+ import WariSelect from './WariSelect.astro';
3
+ import WariStepper from './WariStepper.astro';
2
4
  import type { WariOption } from '../wari/trip';
3
5
 
4
6
  interface Props {
5
7
  /** Nombre del grupo para lectores de pantalla (no se muestra). */
6
8
  legend: string;
9
+ /**
10
+ * Interruptores. Con `description`, `note`, `maxQuantity` o `choices`, al activarlo se despliega su panel:
11
+ * contador (Booster) o una lista por unidad con + y papelera (Carseat).
12
+ */
7
13
  items: WariOption[];
8
14
  /** Valores activos al cargar. */
9
15
  value?: string[];
16
+ /** Cantidad inicial de cada interruptor activo con `maxQuantity` (p. ej. { booster: 2 }). */
17
+ quantities?: Record<string, number>;
18
+ /** Opciones iniciales de cada interruptor activo con `choices` (p. ej. { carseat: ['0-2', '3-5'] }). */
19
+ choices?: Record<string, string[]>;
20
+ /** Texto inicial de los campos de cada interruptor activo con `fields` (p. ej. { carga: { weight: '20' } }). */
21
+ fields?: Record<string, Record<string, string>>;
10
22
  orientation?: 'vertical' | 'horizontal';
11
- /** Envía cada interruptor activo como name=value. */
23
+ /** Envía cada interruptor activo como name=value y su cantidad u opciones como name.value. */
12
24
  name?: string;
13
25
  disabled?: boolean;
14
26
  class?: string;
15
27
  }
16
28
 
17
- const { legend, items, value = [], orientation = 'vertical', name, disabled = false, class: className } = Astro.props;
29
+ const {
30
+ legend, items, value = [], quantities = {}, choices = {}, fields = {}, orientation = 'vertical', name, disabled = false, class: className,
31
+ } = Astro.props;
32
+ const baseId = `ds-wswitches-${Math.random().toString(36).slice(2, 9)}`;
33
+ const trash = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4.5 6.5h15M9.5 6.5V4.5h5v2M6.5 6.5l1 13h9l1-13M10.5 10v6M13.5 10v6"/></svg>';
34
+ const plus = '<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg>';
18
35
  ---
19
36
  <fieldset class:list={['ds-wswitches', className]} data-ds-wswitches data-orientation={orientation} disabled={disabled}>
20
37
  <legend>{legend}</legend>
21
- {items.map(item => (
22
- <label class="ds-wswitch">
23
- <span>{item.label}</span>
24
- <input type="checkbox" role="switch" name={name} value={item.value} checked={value.includes(item.value)} disabled={item.disabled} />
25
- </label>
26
- ))}
38
+ {items.map((item, index) => {
39
+ const checked = value.includes(item.value);
40
+ const hasChoices = Boolean(item.choices?.length);
41
+ const hasFields = Boolean(item.fields?.length);
42
+ const expandable = Boolean(item.description || item.note || item.maxQuantity || hasChoices || hasFields);
43
+ const panelId = `${baseId}-panel-${index}`;
44
+ const descId = `${baseId}-desc-${index}`;
45
+ const max = item.maxQuantity ?? 1;
46
+ const units = checked && hasChoices ? (choices[item.value]?.length ? choices[item.value] : [item.choices![0].value]).slice(0, max) : [];
47
+ const fieldName = name ? `${name}.${item.value}` : undefined;
48
+ return (
49
+ <div class="ds-wswitch-item">
50
+ <label class="ds-wswitch">
51
+ <span>{item.label}</span>
52
+ <input type="checkbox" role="switch" name={name} value={item.value} checked={checked} disabled={item.disabled}
53
+ aria-controls={expandable ? panelId : undefined} aria-expanded={expandable ? String(checked) : undefined}
54
+ aria-describedby={expandable && item.description ? descId : undefined} />
55
+ </label>
56
+ {expandable && (
57
+ <div id={panelId} class="ds-wswitch-panel" hidden={!checked}>
58
+ {item.description && <p id={descId} class="ds-wswitch-desc">{item.description}</p>}
59
+ {hasChoices && (
60
+ <div class="ds-wswitch-units" role="group" aria-label={item.label} data-ds-units={item.value} data-label={item.label} data-max={max}>
61
+ {units.map((unit, unitIndex) => (
62
+ <div class="ds-wswitch-unit">
63
+ <WariSelect ariaLabel={`${item.label} ${unitIndex + 1}`} options={item.choices!} value={unit} name={fieldName}
64
+ disabled={disabled || item.disabled} />
65
+ <button type="button" class="ds-wswitch-unit-button" data-ds-unit-remove hidden={units.length < 2}
66
+ aria-label={`Quitar ${item.label} ${unitIndex + 1}`} disabled={disabled || item.disabled}><Fragment set:html={trash} /></button>
67
+ <button type="button" class="ds-wswitch-unit-button" data-ds-unit-add hidden={unitIndex !== units.length - 1 || units.length >= max}
68
+ aria-label={`Agregar otro ${item.label}`} disabled={disabled || item.disabled}><Fragment set:html={plus} /></button>
69
+ </div>
70
+ ))}
71
+ <template data-ds-unit-template>
72
+ <div class="ds-wswitch-unit">
73
+ <WariSelect ariaLabel={`${item.label} 1`} options={item.choices!} value={item.choices![0].value} name={fieldName}
74
+ disabled={disabled || item.disabled} />
75
+ <button type="button" class="ds-wswitch-unit-button" data-ds-unit-remove aria-label={`Quitar ${item.label} 1`}
76
+ disabled={disabled || item.disabled}><Fragment set:html={trash} /></button>
77
+ <button type="button" class="ds-wswitch-unit-button" data-ds-unit-add aria-label={`Agregar otro ${item.label}`}
78
+ disabled={disabled || item.disabled}><Fragment set:html={plus} /></button>
79
+ </div>
80
+ </template>
81
+ </div>
82
+ )}
83
+ {hasFields && (
84
+ <div class="ds-wswitch-fields" role="group" aria-label={item.label} data-ds-fields={item.value}>
85
+ {item.fields!.map(field => (
86
+ <input class="ds-wswitch-field" type="text" inputmode={field.inputMode ?? 'text'} autocomplete="off"
87
+ aria-label={field.label} placeholder={field.placeholder} data-field={field.name}
88
+ data-fixed={field.width ? 'true' : undefined} style={field.width ? `width:${field.width}` : undefined}
89
+ value={checked ? (fields[item.value]?.[field.name] ?? '') : ''} disabled={disabled || item.disabled || !checked}
90
+ name={fieldName ? `${fieldName}.${field.name}` : undefined} />
91
+ ))}
92
+ </div>
93
+ )}
94
+ {!hasChoices && item.maxQuantity != null && (
95
+ <WariStepper ariaLabel={`Cantidad de ${item.label}`} variant="outlined" min={1} max={item.maxQuantity}
96
+ value={quantities[item.value] ?? 1} name={fieldName}
97
+ disabled={disabled || item.disabled || !checked} data-ds-quantity={item.value} />
98
+ )}
99
+ {item.note && <p class="ds-wswitch-note" role="note">{item.note}</p>}
100
+ </div>
101
+ )}
102
+ </div>
103
+ );
104
+ })}
27
105
  </fieldset>
28
106
 
29
107
  <script>
@@ -47,7 +47,7 @@ const modes = [{ value: 'hourly', label: hourlyLabel }, { value: 'delivery', lab
47
47
  <WariSwitchList legend="Modalidad del viaje" orientation="horizontal" items={modes} name={field('mode')} disabled={disabled}
48
48
  value={[value.hourly ? 'hourly' : '', value.delivery ? 'delivery' : ''].filter(Boolean)} />
49
49
  </div>
50
- <WariSwitchList legend="Extras" items={extras} value={value.extras} name={field('extras')} disabled={disabled} />
50
+ <WariSwitchList legend="Extras" items={extras} value={value.extras} quantities={value.extraQuantities ?? {}} choices={value.extraChoices ?? {}} fields={value.extraFields ?? {}} name={field('extras')} disabled={disabled} />
51
51
  <WariStepper label={vehiclesLabel} value={value.vehicles} min={1} max={maxVehicles} name={field('vehicles')} disabled={disabled} />
52
52
  <WariSelect label={paymentLabel} options={paymentMethods} value={value.payment} name={field('payment')} disabled={disabled} />
53
53
  </div>
@@ -0,0 +1,14 @@
1
+ export type MotionSnapshot = Map<string, DOMRect>;
2
+ export declare function prefersReducedMotion(): boolean;
3
+ /** Positions of every [data-motion] element inside `root`, before a change. */
4
+ export declare function snapshot(root: Element | null | undefined): MotionSnapshot;
5
+ /**
6
+ * After the DOM changed: moved elements slide from their old position, new ones fade in (staggered).
7
+ * Nested [data-motion] elements only fade in; they already move with their parent.
8
+ */
9
+ export declare function animateFrom(root: Element | null | undefined, before: MotionSnapshot): void;
10
+ /**
11
+ * Fades an element out, then runs `remove` (your state change). The fade is cleared on the next frames, so an element that
12
+ * is reused for other content (for example a list keyed by index) shows up again.
13
+ */
14
+ export declare function leave(el: Element | null | undefined, remove: () => void): void;
@@ -0,0 +1,60 @@
1
+ // Generated from web/components/src/wari/motion.ts (same behaviour in React, Angular and Astro).
2
+ // Small FLIP helpers for the Wari route editor: elements marked with data-motion="key" slide to their new place when the
3
+ // list changes, new ones fade in and removed ones fade out first. Framework-free (same file in React, Angular and Astro).
4
+ // Respects prefers-reduced-motion.
5
+ const EASE = 'cubic-bezier(.2, .8, .2, 1)';
6
+ export function prefersReducedMotion() {
7
+ return typeof window === 'undefined' || typeof window.matchMedia !== 'function'
8
+ || window.matchMedia('(prefers-reduced-motion: reduce)').matches;
9
+ }
10
+ const canAnimate = (el) => typeof el.animate === 'function';
11
+ /** Positions of every [data-motion] element inside `root`, before a change. */
12
+ export function snapshot(root) {
13
+ const rects = new Map();
14
+ if (!root || prefersReducedMotion())
15
+ return rects;
16
+ root.querySelectorAll('[data-motion]').forEach(el => rects.set(el.dataset.motion, el.getBoundingClientRect()));
17
+ return rects;
18
+ }
19
+ /**
20
+ * After the DOM changed: moved elements slide from their old position, new ones fade in (staggered).
21
+ * Nested [data-motion] elements only fade in; they already move with their parent.
22
+ */
23
+ export function animateFrom(root, before) {
24
+ if (!root || before.size === 0 || prefersReducedMotion())
25
+ return;
26
+ let entering = 0;
27
+ root.querySelectorAll('[data-motion]').forEach(el => {
28
+ if (!canAnimate(el))
29
+ return;
30
+ const old = before.get(el.dataset.motion);
31
+ if (!old) {
32
+ el.animate([{ opacity: 0, transform: 'translateY(-6px) scale(.98)' }, { opacity: 1, transform: 'none' }], { duration: 240, easing: EASE, delay: Math.min(entering++, 6) * 35, fill: 'backwards' });
33
+ return;
34
+ }
35
+ if (el.parentElement?.closest('[data-motion]') && root.contains(el.parentElement.closest('[data-motion]')))
36
+ return;
37
+ const now = el.getBoundingClientRect();
38
+ const dx = old.left - now.left;
39
+ const dy = old.top - now.top;
40
+ if (Math.abs(dx) < 1 && Math.abs(dy) < 1)
41
+ return;
42
+ el.animate([{ transform: `translate(${dx}px, ${dy}px)` }, { transform: 'none' }], { duration: 280, easing: EASE });
43
+ });
44
+ }
45
+ /**
46
+ * Fades an element out, then runs `remove` (your state change). The fade is cleared on the next frames, so an element that
47
+ * is reused for other content (for example a list keyed by index) shows up again.
48
+ */
49
+ export function leave(el, remove) {
50
+ if (!el || !canAnimate(el) || prefersReducedMotion()) {
51
+ remove();
52
+ return;
53
+ }
54
+ const animation = el.animate([{ opacity: 1, transform: 'none' }, { opacity: 0, transform: 'translateX(12px) scale(.97)' }], { duration: 170, easing: 'ease-in', fill: 'forwards' });
55
+ const done = () => {
56
+ remove();
57
+ requestAnimationFrame(() => requestAnimationFrame(() => animation.cancel()));
58
+ };
59
+ animation.finished.then(done, done);
60
+ }
@@ -0,0 +1,10 @@
1
+ import type { WariRouteValue } from './route';
2
+ export interface WariRouteOptions {
3
+ title?: string; headingLevel?: 2 | 3 | 4; maxStops?: number; maxTolls?: number; showPassengers?: boolean; showTolls?: boolean;
4
+ disabled?: boolean; invertingLabel?: string; invertedMessage?: string; routePassengerNote?: string; inverting?: boolean; inverted?: boolean;
5
+ }
6
+ export declare const routeDefaults: Required<Omit<WariRouteOptions, 'inverting' | 'inverted'>>;
7
+ /** HTML interno de la tarjeta de ruta (el mismo que React y Angular). */
8
+ export declare function routeHtml(value: Partial<WariRouteValue> | null | undefined, options?: WariRouteOptions, baseId?: string): string;
9
+ /** Inicializa las tarjetas <WariRoute>. Idempotente. Cada tarjeta expone dsSetValue(ruta) y dsGetValue(). */
10
+ export declare function initWariRoute(scope?: ParentNode): void;