@azx-pbc/axiom-web 0.0.0-stage → 0.0.6
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/LICENSE +21 -0
- package/README.md +161 -2
- package/dist/address.d.ts +32 -0
- package/dist/address.d.ts.map +1 -0
- package/dist/address.js +146 -0
- package/dist/address.js.map +1 -0
- package/dist/capture/MediaCapture.d.ts +45 -0
- package/dist/capture/MediaCapture.d.ts.map +1 -0
- package/dist/capture/MediaCapture.js +669 -0
- package/dist/capture/MediaCapture.js.map +1 -0
- package/dist/capture/SignatureCapture.d.ts +31 -0
- package/dist/capture/SignatureCapture.d.ts.map +1 -0
- package/dist/capture/SignatureCapture.js +329 -0
- package/dist/capture/SignatureCapture.js.map +1 -0
- package/dist/capture/copy.d.ts +101 -0
- package/dist/capture/copy.d.ts.map +1 -0
- package/dist/capture/copy.js +1369 -0
- package/dist/capture/copy.js.map +1 -0
- package/dist/capture/index.d.ts +19 -0
- package/dist/capture/index.d.ts.map +1 -0
- package/dist/capture/index.js +14 -0
- package/dist/capture/index.js.map +1 -0
- package/dist/capture/media-kind.d.ts +16 -0
- package/dist/capture/media-kind.d.ts.map +1 -0
- package/dist/capture/media-kind.js +64 -0
- package/dist/capture/media-kind.js.map +1 -0
- package/dist/capture/permissions.d.ts +109 -0
- package/dist/capture/permissions.d.ts.map +1 -0
- package/dist/capture/permissions.js +172 -0
- package/dist/capture/permissions.js.map +1 -0
- package/dist/capture/refusal.d.ts +13 -0
- package/dist/capture/refusal.d.ts.map +1 -0
- package/dist/capture/refusal.js +16 -0
- package/dist/capture/refusal.js.map +1 -0
- package/dist/controls.d.ts +64 -0
- package/dist/controls.d.ts.map +1 -0
- package/dist/controls.js +2524 -0
- package/dist/controls.js.map +1 -0
- package/dist/coordinate.d.ts +38 -0
- package/dist/coordinate.d.ts.map +1 -0
- package/dist/coordinate.js +220 -0
- package/dist/coordinate.js.map +1 -0
- package/dist/copy.d.ts +313 -0
- package/dist/copy.d.ts.map +1 -0
- package/dist/copy.js +2602 -0
- package/dist/copy.js.map +1 -0
- package/dist/countries.d.ts +14 -0
- package/dist/countries.d.ts.map +1 -0
- package/dist/countries.js +264 -0
- package/dist/countries.js.map +1 -0
- package/dist/format/calendar-locale.d.ts +19 -0
- package/dist/format/calendar-locale.d.ts.map +1 -0
- package/dist/format/calendar-locale.js +38 -0
- package/dist/format/calendar-locale.js.map +1 -0
- package/dist/format/country-names.d.ts +21 -0
- package/dist/format/country-names.d.ts.map +1 -0
- package/dist/format/country-names.js +2277 -0
- package/dist/format/country-names.js.map +1 -0
- package/dist/format/date.d.ts +58 -0
- package/dist/format/date.d.ts.map +1 -0
- package/dist/format/date.js +155 -0
- package/dist/format/date.js.map +1 -0
- package/dist/format/digits.d.ts +23 -0
- package/dist/format/digits.d.ts.map +1 -0
- package/dist/format/digits.js +46 -0
- package/dist/format/digits.js.map +1 -0
- package/dist/format/index.d.ts +28 -0
- package/dist/format/index.d.ts.map +1 -0
- package/dist/format/index.js +24 -0
- package/dist/format/index.js.map +1 -0
- package/dist/format/locale.d.ts +33 -0
- package/dist/format/locale.d.ts.map +1 -0
- package/dist/format/locale.js +39 -0
- package/dist/format/locale.js.map +1 -0
- package/dist/format/media-type.d.ts +8 -0
- package/dist/format/media-type.d.ts.map +1 -0
- package/dist/format/media-type.js +302 -0
- package/dist/format/media-type.js.map +1 -0
- package/dist/format/money.d.ts +52 -0
- package/dist/format/money.d.ts.map +1 -0
- package/dist/format/money.js +36 -0
- package/dist/format/money.js.map +1 -0
- package/dist/format/number.d.ts +28 -0
- package/dist/format/number.d.ts.map +1 -0
- package/dist/format/number.js +91 -0
- package/dist/format/number.js.map +1 -0
- package/dist/host.d.ts +122 -0
- package/dist/host.d.ts.map +1 -0
- package/dist/host.js +20 -0
- package/dist/host.js.map +1 -0
- package/dist/index.d.ts +57 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/media.d.ts +42 -0
- package/dist/media.d.ts.map +1 -0
- package/dist/media.js +151 -0
- package/dist/media.js.map +1 -0
- package/dist/pickers/DatePicker.d.ts +35 -0
- package/dist/pickers/DatePicker.d.ts.map +1 -0
- package/dist/pickers/DatePicker.js +212 -0
- package/dist/pickers/DatePicker.js.map +1 -0
- package/dist/pickers/TimeSegments.d.ts +27 -0
- package/dist/pickers/TimeSegments.d.ts.map +1 -0
- package/dist/pickers/TimeSegments.js +82 -0
- package/dist/pickers/TimeSegments.js.map +1 -0
- package/dist/pickers/day-picker-locale.d.ts +15 -0
- package/dist/pickers/day-picker-locale.d.ts.map +1 -0
- package/dist/pickers/day-picker-locale.js +46 -0
- package/dist/pickers/day-picker-locale.js.map +1 -0
- package/dist/render/dom.d.ts +100 -0
- package/dist/render/dom.d.ts.map +1 -0
- package/dist/render/dom.js +882 -0
- package/dist/render/dom.js.map +1 -0
- package/dist/render/layout.d.ts +45 -0
- package/dist/render/layout.d.ts.map +1 -0
- package/dist/render/layout.js +8 -0
- package/dist/render/layout.js.map +1 -0
- package/dist/schedule/SchedulePicker.d.ts +46 -0
- package/dist/schedule/SchedulePicker.d.ts.map +1 -0
- package/dist/schedule/SchedulePicker.js +160 -0
- package/dist/schedule/SchedulePicker.js.map +1 -0
- package/dist/schedule/timeslot.d.ts +52 -0
- package/dist/schedule/timeslot.d.ts.map +1 -0
- package/dist/schedule/timeslot.js +265 -0
- package/dist/schedule/timeslot.js.map +1 -0
- package/dist/styles.css +2151 -0
- package/dist/theme/index.d.ts +12 -0
- package/dist/theme/index.d.ts.map +1 -0
- package/dist/theme/index.js +11 -0
- package/dist/theme/index.js.map +1 -0
- package/dist/theme/presets.d.ts +93 -0
- package/dist/theme/presets.d.ts.map +1 -0
- package/dist/theme/presets.js +200 -0
- package/dist/theme/presets.js.map +1 -0
- package/dist/tokens.css +234 -0
- package/dist/wizard-checkpoints.d.ts +18 -0
- package/dist/wizard-checkpoints.d.ts.map +1 -0
- package/dist/wizard-checkpoints.js +56 -0
- package/dist/wizard-checkpoints.js.map +1 -0
- package/package.json +76 -3
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { TimeslotValue } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
/** One offered window, read from the wire's `timeslot` value and the control's option page. */
|
|
3
|
+
export interface TimeslotSlot {
|
|
4
|
+
readonly value: TimeslotValue;
|
|
5
|
+
readonly localDate: string;
|
|
6
|
+
readonly startMinutes: number;
|
|
7
|
+
readonly endMinutes: number;
|
|
8
|
+
}
|
|
9
|
+
/** Whether a value is the `{ slotId, localDate, start, end }` record a timeslot carries. */
|
|
10
|
+
export declare function isTimeslotValue(value: unknown): value is TimeslotValue;
|
|
11
|
+
/** The minutes after midnight an ISO instant's clock names, or `undefined` for malformed text. */
|
|
12
|
+
export declare function clockMinutes(iso: string): number | undefined;
|
|
13
|
+
/** One offered window, or `undefined` when the value is not a complete timeslot. */
|
|
14
|
+
export declare function slotOf(value: unknown): TimeslotSlot | undefined;
|
|
15
|
+
/** The civil date of a local `Date`, as the wire's `YYYY-MM-DD`. */
|
|
16
|
+
export declare function civilKey(date: Date): string;
|
|
17
|
+
/** The local `Date` a civil key names, at noon so a DST boundary cannot move the day. */
|
|
18
|
+
export declare function civilDate(key: string): Date | undefined;
|
|
19
|
+
/** Whether a locale conventionally reads a 12-hour clock. */
|
|
20
|
+
export declare function usesHour12(locale: string | undefined): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* One clock reading in the host locale: `9:00 AM` on a twelve-hour clock, `09:00` otherwise.
|
|
23
|
+
*
|
|
24
|
+
* The words come from the same schedule catalogue the rest of the picker paints, so the clock
|
|
25
|
+
* and the AM/PM toggle cannot disagree and no locale formatter is consulted.
|
|
26
|
+
*/
|
|
27
|
+
export declare function timeLabel(minutes: number, locale: string | undefined): string;
|
|
28
|
+
/** A window as `9:00–11:00 AM` (or `09:00–11:00`), never the wire's ISO text. */
|
|
29
|
+
export declare function rangeLabel(slot: TimeslotSlot, locale: string | undefined): string;
|
|
30
|
+
/** The duration as text: `2 h`, `1 h 30 min`. */
|
|
31
|
+
export declare function durationLabel(minutes: number): string;
|
|
32
|
+
/** The words a locale needs around the calendar and the slot list. */
|
|
33
|
+
export interface ScheduleText {
|
|
34
|
+
readonly previousMonth: string;
|
|
35
|
+
readonly nextMonth: string;
|
|
36
|
+
readonly noTimes: string;
|
|
37
|
+
readonly noAvailability: string;
|
|
38
|
+
readonly chooseDate: string;
|
|
39
|
+
readonly hours: string;
|
|
40
|
+
readonly minutes: string;
|
|
41
|
+
readonly seconds: string;
|
|
42
|
+
readonly am: string;
|
|
43
|
+
readonly pm: string;
|
|
44
|
+
readonly unavailable: string;
|
|
45
|
+
readonly loading: string;
|
|
46
|
+
readonly failed: (detail: string) => string;
|
|
47
|
+
readonly retry: string;
|
|
48
|
+
readonly invalidDate: string;
|
|
49
|
+
}
|
|
50
|
+
/** The locale's schedule words, falling back to English for a language not carried. */
|
|
51
|
+
export declare function scheduleText(locale: string | undefined): ScheduleText;
|
|
52
|
+
//# sourceMappingURL=timeslot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeslot.d.ts","sourceRoot":"","sources":["../../src/schedule/timeslot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAI5D,+FAA+F;AAC/F,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAED,4FAA4F;AAC5F,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAQtE;AAED,kGAAkG;AAClG,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAQ5D;AAED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,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AA8JD,uFAAuF;AACvF,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,YAAY,CAErE"}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { isRecord } from '@azx-pbc/axiom-runtime';
|
|
2
|
+
import { resolveLocale } from '../format/locale.js';
|
|
3
|
+
/** Whether a value is the `{ slotId, localDate, start, end }` record a timeslot carries. */
|
|
4
|
+
export function isTimeslotValue(value) {
|
|
5
|
+
if (!isRecord(value))
|
|
6
|
+
return false;
|
|
7
|
+
return (typeof value['slotId'] === 'string' &&
|
|
8
|
+
typeof value['localDate'] === 'string' &&
|
|
9
|
+
typeof value['start'] === 'string' &&
|
|
10
|
+
typeof value['end'] === 'string');
|
|
11
|
+
}
|
|
12
|
+
/** The minutes after midnight an ISO instant's clock names, or `undefined` for malformed text. */
|
|
13
|
+
export function clockMinutes(iso) {
|
|
14
|
+
const match = /T(\d{2}):(\d{2})/u.exec(iso);
|
|
15
|
+
if (match === null)
|
|
16
|
+
return undefined;
|
|
17
|
+
const hours = Number(match[1]);
|
|
18
|
+
const minutes = Number(match[2]);
|
|
19
|
+
if (!Number.isInteger(hours) || !Number.isInteger(minutes))
|
|
20
|
+
return undefined;
|
|
21
|
+
if (hours > 23 || minutes > 59)
|
|
22
|
+
return undefined;
|
|
23
|
+
return hours * 60 + minutes;
|
|
24
|
+
}
|
|
25
|
+
/** One offered window, or `undefined` when the value is not a complete timeslot. */
|
|
26
|
+
export function slotOf(value) {
|
|
27
|
+
if (!isTimeslotValue(value))
|
|
28
|
+
return undefined;
|
|
29
|
+
const start = clockMinutes(value.start);
|
|
30
|
+
const end = clockMinutes(value.end);
|
|
31
|
+
if (start === undefined || end === undefined || end <= start)
|
|
32
|
+
return undefined;
|
|
33
|
+
return { value, localDate: value.localDate, startMinutes: start, endMinutes: end };
|
|
34
|
+
}
|
|
35
|
+
/** The civil date of a local `Date`, as the wire's `YYYY-MM-DD`. */
|
|
36
|
+
export function civilKey(date) {
|
|
37
|
+
const year = date.getFullYear();
|
|
38
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
39
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
40
|
+
return `${String(year)}-${month}-${day}`;
|
|
41
|
+
}
|
|
42
|
+
/** The local `Date` a civil key names, at noon so a DST boundary cannot move the day. */
|
|
43
|
+
export function civilDate(key) {
|
|
44
|
+
const match = /^(\d{4})-(\d{2})-(\d{2})$/u.exec(key);
|
|
45
|
+
if (match === null)
|
|
46
|
+
return undefined;
|
|
47
|
+
const year = Number(match[1]);
|
|
48
|
+
const month = Number(match[2]);
|
|
49
|
+
const day = Number(match[3]);
|
|
50
|
+
// `new Date(year, ...)` maps years 0..99 onto 1900..1999, so the components are set on a
|
|
51
|
+
// known instant instead. A date that does not survive the round trip is not a civil day:
|
|
52
|
+
// `2026-02-30` would otherwise silently become 2 March and write a day nobody chose.
|
|
53
|
+
const date = new Date(0);
|
|
54
|
+
date.setFullYear(year, month - 1, day);
|
|
55
|
+
date.setHours(12, 0, 0, 0);
|
|
56
|
+
if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
return date;
|
|
60
|
+
}
|
|
61
|
+
/** The host locale's language, or `en` when none is stated. The one resolver normalises it. */
|
|
62
|
+
function languageOf(locale) {
|
|
63
|
+
return resolveLocale(locale).language;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The languages that read a twelve-hour clock in this chrome.
|
|
67
|
+
*
|
|
68
|
+
* The resolver keeps no region, so the clock is one convention per language rather than a
|
|
69
|
+
* per-locale database answer: English and Arabic read a twelve-hour day, and the other seven read
|
|
70
|
+
* a twenty-four hour day. A host that needs a regional convention asks for that locale through
|
|
71
|
+
* its own control, because the shipped table holds the language and not the region.
|
|
72
|
+
*/
|
|
73
|
+
const HOUR12_LANGUAGES = new Set(['en', 'ar']);
|
|
74
|
+
/** Whether a locale conventionally reads a 12-hour clock. */
|
|
75
|
+
export function usesHour12(locale) {
|
|
76
|
+
return HOUR12_LANGUAGES.has(languageOf(locale));
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* One clock reading in the host locale: `9:00 AM` on a twelve-hour clock, `09:00` otherwise.
|
|
80
|
+
*
|
|
81
|
+
* The words come from the same schedule catalogue the rest of the picker paints, so the clock
|
|
82
|
+
* and the AM/PM toggle cannot disagree and no locale formatter is consulted.
|
|
83
|
+
*/
|
|
84
|
+
export function timeLabel(minutes, locale) {
|
|
85
|
+
const hour = Math.floor(minutes / 60);
|
|
86
|
+
const minute = minutes % 60;
|
|
87
|
+
if (!usesHour12(locale)) {
|
|
88
|
+
return `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}`;
|
|
89
|
+
}
|
|
90
|
+
const text = scheduleText(locale);
|
|
91
|
+
const hour12 = hour % 12 === 0 ? 12 : hour % 12;
|
|
92
|
+
return `${String(hour12)}:${String(minute).padStart(2, '0')} ${hour < 12 ? text.am : text.pm}`;
|
|
93
|
+
}
|
|
94
|
+
/** A window as `9:00–11:00 AM` (or `09:00–11:00`), never the wire's ISO text. */
|
|
95
|
+
export function rangeLabel(slot, locale) {
|
|
96
|
+
return `${timeLabel(slot.startMinutes, locale)}–${timeLabel(slot.endMinutes, locale)}`;
|
|
97
|
+
}
|
|
98
|
+
/** The duration as text: `2 h`, `1 h 30 min`. */
|
|
99
|
+
export function durationLabel(minutes) {
|
|
100
|
+
const hours = Math.floor(minutes / 60);
|
|
101
|
+
const rest = minutes % 60;
|
|
102
|
+
if (hours === 0)
|
|
103
|
+
return `${String(rest)} min`;
|
|
104
|
+
return rest === 0 ? `${String(hours)} h` : `${String(hours)} h ${String(rest)} min`;
|
|
105
|
+
}
|
|
106
|
+
const TEXT = {
|
|
107
|
+
en: {
|
|
108
|
+
previousMonth: 'Previous month',
|
|
109
|
+
nextMonth: 'Next month',
|
|
110
|
+
hours: 'Hours',
|
|
111
|
+
minutes: 'Minutes',
|
|
112
|
+
seconds: 'Seconds',
|
|
113
|
+
am: 'AM',
|
|
114
|
+
pm: 'PM',
|
|
115
|
+
chooseDate: 'Choose a date',
|
|
116
|
+
noTimes: 'No times on this day',
|
|
117
|
+
noAvailability: 'No availability is offered',
|
|
118
|
+
unavailable: 'Unavailable',
|
|
119
|
+
loading: 'Loading availability…',
|
|
120
|
+
failed: (detail) => `Availability could not be loaded: ${detail}`,
|
|
121
|
+
retry: 'Try again',
|
|
122
|
+
invalidDate: 'Use YYYY-MM-DD or the date as it is shown.',
|
|
123
|
+
},
|
|
124
|
+
es: {
|
|
125
|
+
previousMonth: 'Mes anterior',
|
|
126
|
+
nextMonth: 'Mes siguiente',
|
|
127
|
+
hours: 'Horas',
|
|
128
|
+
minutes: 'Minutos',
|
|
129
|
+
seconds: 'Segundos',
|
|
130
|
+
am: 'a. m.',
|
|
131
|
+
pm: 'p. m.',
|
|
132
|
+
chooseDate: 'Elegir una fecha',
|
|
133
|
+
noTimes: 'No hay horarios este día',
|
|
134
|
+
noAvailability: 'No se ofrece disponibilidad',
|
|
135
|
+
unavailable: 'No disponible',
|
|
136
|
+
loading: 'Cargando disponibilidad…',
|
|
137
|
+
failed: (detail) => `No se pudo cargar la disponibilidad: ${detail}`,
|
|
138
|
+
retry: 'Reintentar',
|
|
139
|
+
invalidDate: 'Usa AAAA-MM-DD o la fecha tal como se muestra.',
|
|
140
|
+
},
|
|
141
|
+
pt: {
|
|
142
|
+
previousMonth: 'Mês anterior',
|
|
143
|
+
nextMonth: 'Mês seguinte',
|
|
144
|
+
hours: 'Horas',
|
|
145
|
+
minutes: 'Minutos',
|
|
146
|
+
seconds: 'Segundos',
|
|
147
|
+
am: 'AM',
|
|
148
|
+
pm: 'PM',
|
|
149
|
+
chooseDate: 'Escolher uma data',
|
|
150
|
+
noTimes: 'Não há horários neste dia',
|
|
151
|
+
noAvailability: 'Não há disponibilidade',
|
|
152
|
+
unavailable: 'Indisponível',
|
|
153
|
+
loading: 'A carregar disponibilidade…',
|
|
154
|
+
failed: (detail) => `Não foi possível carregar a disponibilidade: ${detail}`,
|
|
155
|
+
retry: 'Tentar novamente',
|
|
156
|
+
invalidDate: 'Use AAAA-MM-DD ou a data como é mostrada.',
|
|
157
|
+
},
|
|
158
|
+
fr: {
|
|
159
|
+
previousMonth: 'Mois précédent',
|
|
160
|
+
nextMonth: 'Mois suivant',
|
|
161
|
+
hours: 'Heures',
|
|
162
|
+
minutes: 'Minutes',
|
|
163
|
+
seconds: 'Secondes',
|
|
164
|
+
am: 'AM',
|
|
165
|
+
pm: 'PM',
|
|
166
|
+
chooseDate: 'Choisir une date',
|
|
167
|
+
noTimes: 'Aucun horaire ce jour',
|
|
168
|
+
noAvailability: 'Aucune disponibilité proposée',
|
|
169
|
+
unavailable: 'Indisponible',
|
|
170
|
+
loading: 'Chargement des disponibilités…',
|
|
171
|
+
failed: (detail) => `Les disponibilités n'ont pas pu être chargées : ${detail}`,
|
|
172
|
+
retry: 'Réessayer',
|
|
173
|
+
invalidDate: "Utilisez AAAA-MM-JJ ou la date telle qu'elle est affichée.",
|
|
174
|
+
},
|
|
175
|
+
ar: {
|
|
176
|
+
previousMonth: 'الشهر السابق',
|
|
177
|
+
nextMonth: 'الشهر التالي',
|
|
178
|
+
hours: 'الساعات',
|
|
179
|
+
minutes: 'الدقائق',
|
|
180
|
+
seconds: 'الثواني',
|
|
181
|
+
am: 'ص',
|
|
182
|
+
pm: 'م',
|
|
183
|
+
chooseDate: 'اختر تاريخًا',
|
|
184
|
+
noTimes: 'لا توجد أوقات في هذا اليوم',
|
|
185
|
+
noAvailability: 'لا تتوفر أي مواعيد',
|
|
186
|
+
unavailable: 'غير متاح',
|
|
187
|
+
loading: 'جارٍ تحميل المواعيد…',
|
|
188
|
+
failed: (detail) => `تعذّر تحميل المواعيد: ${detail}`,
|
|
189
|
+
retry: 'حاول مرة أخرى',
|
|
190
|
+
invalidDate: 'استخدم YYYY-MM-DD أو التاريخ كما يظهر.',
|
|
191
|
+
},
|
|
192
|
+
de: {
|
|
193
|
+
previousMonth: 'Vorheriger Monat',
|
|
194
|
+
nextMonth: 'Nächster Monat',
|
|
195
|
+
hours: 'Stunden',
|
|
196
|
+
minutes: 'Minuten',
|
|
197
|
+
seconds: 'Sekunden',
|
|
198
|
+
am: 'vorm.',
|
|
199
|
+
pm: 'nachm.',
|
|
200
|
+
chooseDate: 'Datum wählen',
|
|
201
|
+
noTimes: 'An diesem Tag gibt es keine Zeiten',
|
|
202
|
+
noAvailability: 'Es wird keine Verfügbarkeit angeboten',
|
|
203
|
+
unavailable: 'Nicht verfügbar',
|
|
204
|
+
loading: 'Verfügbarkeit wird geladen…',
|
|
205
|
+
failed: (detail) => `Verfügbarkeit konnte nicht geladen werden: ${detail}`,
|
|
206
|
+
retry: 'Erneut versuchen',
|
|
207
|
+
invalidDate: 'Verwenden Sie JJJJ-MM-TT oder das angezeigte Datum.',
|
|
208
|
+
},
|
|
209
|
+
it: {
|
|
210
|
+
previousMonth: 'Mese precedente',
|
|
211
|
+
nextMonth: 'Mese successivo',
|
|
212
|
+
hours: 'Ore',
|
|
213
|
+
minutes: 'Minuti',
|
|
214
|
+
seconds: 'Secondi',
|
|
215
|
+
am: 'AM',
|
|
216
|
+
pm: 'PM',
|
|
217
|
+
chooseDate: 'Scegli una data',
|
|
218
|
+
noTimes: 'Nessun orario in questo giorno',
|
|
219
|
+
noAvailability: 'Nessuna disponibilità offerta',
|
|
220
|
+
unavailable: 'Non disponibile',
|
|
221
|
+
loading: 'Caricamento disponibilità…',
|
|
222
|
+
failed: (detail) => `Impossibile caricare la disponibilità: ${detail}`,
|
|
223
|
+
retry: 'Riprova',
|
|
224
|
+
invalidDate: 'Usa AAAA-MM-GG o la data come viene mostrata.',
|
|
225
|
+
},
|
|
226
|
+
ru: {
|
|
227
|
+
previousMonth: 'Предыдущий месяц',
|
|
228
|
+
nextMonth: 'Следующий месяц',
|
|
229
|
+
hours: 'Часы',
|
|
230
|
+
minutes: 'Минуты',
|
|
231
|
+
seconds: 'Секунды',
|
|
232
|
+
am: 'AM',
|
|
233
|
+
pm: 'PM',
|
|
234
|
+
chooseDate: 'Выберите дату',
|
|
235
|
+
noTimes: 'В этот день нет доступного времени',
|
|
236
|
+
noAvailability: 'Доступность не предложена',
|
|
237
|
+
unavailable: 'Недоступно',
|
|
238
|
+
loading: 'Загрузка доступности…',
|
|
239
|
+
failed: (detail) => `Не удалось загрузить доступность: ${detail}`,
|
|
240
|
+
retry: 'Повторить',
|
|
241
|
+
invalidDate: 'Используйте ГГГГ-ММ-ДД или дату в показанном виде.',
|
|
242
|
+
},
|
|
243
|
+
zh: {
|
|
244
|
+
previousMonth: '上个月',
|
|
245
|
+
nextMonth: '下个月',
|
|
246
|
+
hours: '小时',
|
|
247
|
+
minutes: '分钟',
|
|
248
|
+
seconds: '秒',
|
|
249
|
+
am: '上午',
|
|
250
|
+
pm: '下午',
|
|
251
|
+
chooseDate: '选择日期',
|
|
252
|
+
noTimes: '这一天没有可用的时间',
|
|
253
|
+
noAvailability: '没有提供可用时段',
|
|
254
|
+
unavailable: '不可用',
|
|
255
|
+
loading: '正在加载可用时段…',
|
|
256
|
+
failed: (detail) => `无法加载可用时段:${detail}`,
|
|
257
|
+
retry: '重试',
|
|
258
|
+
invalidDate: '请使用 YYYY-MM-DD 或显示的日期格式。',
|
|
259
|
+
},
|
|
260
|
+
};
|
|
261
|
+
/** The locale's schedule words, falling back to English for a language not carried. */
|
|
262
|
+
export function scheduleText(locale) {
|
|
263
|
+
return TEXT[languageOf(locale)];
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=timeslot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeslot.js","sourceRoot":"","sources":["../../src/schedule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AAE,WAAW;QACpB,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,MAAM,EAAE;QACxC,KAAK,EAAE,IAAI;QACX,WAAW,EAAE,0BAA0B;KACxC;CACF,CAAC;AAEF,uFAAuF;AACvF,MAAM,UAAU,YAAY,CAAC,MAA0B;IACrD,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AAClC,CAAC","sourcesContent":["import { isRecord } from '@azx-pbc/axiom-runtime';\nimport type { TimeslotValue } from '@azx-pbc/axiom-runtime';\nimport { resolveLocale } from '../format/locale.js';\nimport type { Locale } from '../format/locale.js';\n\n/** One offered window, read from the wire's `timeslot` value and the control's option page. */\nexport interface TimeslotSlot {\n readonly value: TimeslotValue;\n readonly localDate: string;\n readonly startMinutes: number;\n readonly endMinutes: number;\n}\n\n/** Whether a value is the `{ slotId, localDate, start, end }` record a timeslot carries. */\nexport function isTimeslotValue(value: unknown): value is TimeslotValue {\n if (!isRecord(value)) return false;\n return (\n typeof value['slotId'] === 'string' &&\n typeof value['localDate'] === 'string' &&\n typeof value['start'] === 'string' &&\n typeof value['end'] === 'string'\n );\n}\n\n/** The minutes after midnight an ISO instant's clock names, or `undefined` for malformed text. */\nexport function clockMinutes(iso: string): number | undefined {\n const match = /T(\\d{2}):(\\d{2})/u.exec(iso);\n if (match === null) return undefined;\n const hours = Number(match[1]);\n const minutes = Number(match[2]);\n if (!Number.isInteger(hours) || !Number.isInteger(minutes)) return undefined;\n if (hours > 23 || minutes > 59) return undefined;\n return hours * 60 + minutes;\n}\n\n/** One offered window, or `undefined` when the value is not a complete timeslot. */\nexport function slotOf(value: unknown): TimeslotSlot | undefined {\n if (!isTimeslotValue(value)) return undefined;\n const start = clockMinutes(value.start);\n const end = clockMinutes(value.end);\n if (start === undefined || end === undefined || end <= start) return undefined;\n return { value, localDate: value.localDate, startMinutes: start, endMinutes: end };\n}\n\n/** The civil date of a local `Date`, as the wire's `YYYY-MM-DD`. */\nexport function civilKey(date: Date): string {\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n return `${String(year)}-${month}-${day}`;\n}\n\n/** The local `Date` a civil key names, at noon so a DST boundary cannot move the day. */\nexport function civilDate(key: string): Date | undefined {\n const match = /^(\\d{4})-(\\d{2})-(\\d{2})$/u.exec(key);\n if (match === null) return undefined;\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n // `new Date(year, ...)` maps years 0..99 onto 1900..1999, so the components are set on a\n // known instant instead. A date that does not survive the round trip is not a civil day:\n // `2026-02-30` would otherwise silently become 2 March and write a day nobody chose.\n const date = new Date(0);\n date.setFullYear(year, month - 1, day);\n date.setHours(12, 0, 0, 0);\n if (date.getFullYear() !== year || date.getMonth() !== month - 1 || date.getDate() !== day) {\n return undefined;\n }\n return date;\n}\n\n/** The host locale's language, or `en` when none is stated. The one resolver normalises it. */\nfunction languageOf(locale: string | undefined): Locale {\n return resolveLocale(locale).language;\n}\n\n/**\n * The languages that read a twelve-hour clock in this chrome.\n *\n * The resolver keeps no region, so the clock is one convention per language rather than a\n * per-locale database answer: English and Arabic read a twelve-hour day, and the other seven read\n * a twenty-four hour day. A host that needs a regional convention asks for that locale through\n * its own control, because the shipped table holds the language and not the region.\n */\nconst HOUR12_LANGUAGES: ReadonlySet<Locale> = new Set<Locale>(['en', 'ar']);\n\n/** Whether a locale conventionally reads a 12-hour clock. */\nexport function usesHour12(locale: string | undefined): boolean {\n return HOUR12_LANGUAGES.has(languageOf(locale));\n}\n\n/**\n * One clock reading in the host locale: `9:00 AM` on a twelve-hour clock, `09:00` otherwise.\n *\n * The words come from the same schedule catalogue the rest of the picker paints, so the clock\n * and the AM/PM toggle cannot disagree and no locale formatter is consulted.\n */\nexport function timeLabel(minutes: number, locale: string | undefined): string {\n const hour = Math.floor(minutes / 60);\n const minute = minutes % 60;\n if (!usesHour12(locale)) {\n return `${String(hour).padStart(2, '0')}:${String(minute).padStart(2, '0')}`;\n }\n const text = scheduleText(locale);\n const hour12 = hour % 12 === 0 ? 12 : hour % 12;\n return `${String(hour12)}:${String(minute).padStart(2, '0')} ${hour < 12 ? text.am : text.pm}`;\n}\n\n/** A window as `9:00–11:00 AM` (or `09:00–11:00`), never the wire's ISO text. */\nexport function rangeLabel(slot: TimeslotSlot, locale: string | undefined): string {\n return `${timeLabel(slot.startMinutes, locale)}–${timeLabel(slot.endMinutes, locale)}`;\n}\n\n/** The duration as text: `2 h`, `1 h 30 min`. */\nexport function durationLabel(minutes: number): string {\n const hours = Math.floor(minutes / 60);\n const rest = minutes % 60;\n if (hours === 0) return `${String(rest)} min`;\n return rest === 0 ? `${String(hours)} h` : `${String(hours)} h ${String(rest)} min`;\n}\n\n/** The words a locale needs around the calendar and the slot list. */\nexport interface ScheduleText {\n readonly previousMonth: string;\n readonly nextMonth: string;\n readonly noTimes: string;\n readonly noAvailability: string;\n readonly chooseDate: string;\n readonly hours: string;\n readonly minutes: string;\n readonly seconds: string;\n readonly am: string;\n readonly pm: string;\n readonly unavailable: string;\n readonly loading: string;\n readonly failed: (detail: string) => string;\n readonly retry: string;\n readonly invalidDate: string;\n}\n\nconst TEXT: Readonly<Record<Locale, ScheduleText>> = {\n en: {\n previousMonth: 'Previous month',\n nextMonth: 'Next month',\n hours: 'Hours',\n minutes: 'Minutes',\n seconds: 'Seconds',\n am: 'AM',\n pm: 'PM',\n chooseDate: 'Choose a date',\n noTimes: 'No times on this day',\n noAvailability: 'No availability is offered',\n unavailable: 'Unavailable',\n loading: 'Loading availability…',\n failed: (detail) => `Availability could not be loaded: ${detail}`,\n retry: 'Try again',\n invalidDate: 'Use YYYY-MM-DD or the date as it is shown.',\n },\n es: {\n previousMonth: 'Mes anterior',\n nextMonth: 'Mes siguiente',\n hours: 'Horas',\n minutes: 'Minutos',\n seconds: 'Segundos',\n am: 'a. m.',\n pm: 'p. m.',\n chooseDate: 'Elegir una fecha',\n noTimes: 'No hay horarios este día',\n noAvailability: 'No se ofrece disponibilidad',\n unavailable: 'No disponible',\n loading: 'Cargando disponibilidad…',\n failed: (detail) => `No se pudo cargar la disponibilidad: ${detail}`,\n retry: 'Reintentar',\n invalidDate: 'Usa AAAA-MM-DD o la fecha tal como se muestra.',\n },\n pt: {\n previousMonth: 'Mês anterior',\n nextMonth: 'Mês seguinte',\n hours: 'Horas',\n minutes: 'Minutos',\n seconds: 'Segundos',\n am: 'AM',\n pm: 'PM',\n chooseDate: 'Escolher uma data',\n noTimes: 'Não há horários neste dia',\n noAvailability: 'Não há disponibilidade',\n unavailable: 'Indisponível',\n loading: 'A carregar disponibilidade…',\n failed: (detail) => `Não foi possível carregar a disponibilidade: ${detail}`,\n retry: 'Tentar novamente',\n invalidDate: 'Use AAAA-MM-DD ou a data como é mostrada.',\n },\n fr: {\n previousMonth: 'Mois précédent',\n nextMonth: 'Mois suivant',\n hours: 'Heures',\n minutes: 'Minutes',\n seconds: 'Secondes',\n am: 'AM',\n pm: 'PM',\n chooseDate: 'Choisir une date',\n noTimes: 'Aucun horaire ce jour',\n noAvailability: 'Aucune disponibilité proposée',\n unavailable: 'Indisponible',\n loading: 'Chargement des disponibilités…',\n failed: (detail) => `Les disponibilités n'ont pas pu être chargées : ${detail}`,\n retry: 'Réessayer',\n invalidDate: \"Utilisez AAAA-MM-JJ ou la date telle qu'elle est affichée.\",\n },\n ar: {\n previousMonth: 'الشهر السابق',\n nextMonth: 'الشهر التالي',\n hours: 'الساعات',\n minutes: 'الدقائق',\n seconds: 'الثواني',\n am: 'ص',\n pm: 'م',\n chooseDate: 'اختر تاريخًا',\n noTimes: 'لا توجد أوقات في هذا اليوم',\n noAvailability: 'لا تتوفر أي مواعيد',\n unavailable: 'غير متاح',\n loading: 'جارٍ تحميل المواعيد…',\n failed: (detail) => `تعذّر تحميل المواعيد: ${detail}`,\n retry: 'حاول مرة أخرى',\n invalidDate: 'استخدم YYYY-MM-DD أو التاريخ كما يظهر.',\n },\n de: {\n previousMonth: 'Vorheriger Monat',\n nextMonth: 'Nächster Monat',\n hours: 'Stunden',\n minutes: 'Minuten',\n seconds: 'Sekunden',\n am: 'vorm.',\n pm: 'nachm.',\n chooseDate: 'Datum wählen',\n noTimes: 'An diesem Tag gibt es keine Zeiten',\n noAvailability: 'Es wird keine Verfügbarkeit angeboten',\n unavailable: 'Nicht verfügbar',\n loading: 'Verfügbarkeit wird geladen…',\n failed: (detail) => `Verfügbarkeit konnte nicht geladen werden: ${detail}`,\n retry: 'Erneut versuchen',\n invalidDate: 'Verwenden Sie JJJJ-MM-TT oder das angezeigte Datum.',\n },\n it: {\n previousMonth: 'Mese precedente',\n nextMonth: 'Mese successivo',\n hours: 'Ore',\n minutes: 'Minuti',\n seconds: 'Secondi',\n am: 'AM',\n pm: 'PM',\n chooseDate: 'Scegli una data',\n noTimes: 'Nessun orario in questo giorno',\n noAvailability: 'Nessuna disponibilità offerta',\n unavailable: 'Non disponibile',\n loading: 'Caricamento disponibilità…',\n failed: (detail) => `Impossibile caricare la disponibilità: ${detail}`,\n retry: 'Riprova',\n invalidDate: 'Usa AAAA-MM-GG o la data come viene mostrata.',\n },\n ru: {\n previousMonth: 'Предыдущий месяц',\n nextMonth: 'Следующий месяц',\n hours: 'Часы',\n minutes: 'Минуты',\n seconds: 'Секунды',\n am: 'AM',\n pm: 'PM',\n chooseDate: 'Выберите дату',\n noTimes: 'В этот день нет доступного времени',\n noAvailability: 'Доступность не предложена',\n unavailable: 'Недоступно',\n loading: 'Загрузка доступности…',\n failed: (detail) => `Не удалось загрузить доступность: ${detail}`,\n retry: 'Повторить',\n invalidDate: 'Используйте ГГГГ-ММ-ДД или дату в показанном виде.',\n },\n zh: {\n previousMonth: '上个月',\n nextMonth: '下个月',\n hours: '小时',\n minutes: '分钟',\n seconds: '秒',\n am: '上午',\n pm: '下午',\n chooseDate: '选择日期',\n noTimes: '这一天没有可用的时间',\n noAvailability: '没有提供可用时段',\n unavailable: '不可用',\n loading: '正在加载可用时段…',\n failed: (detail) => `无法加载可用时段:${detail}`,\n retry: '重试',\n invalidDate: '请使用 YYYY-MM-DD 或显示的日期格式。',\n },\n};\n\n/** The locale's schedule words, falling back to English for a language not carried. */\nexport function scheduleText(locale: string | undefined): ScheduleText {\n return TEXT[languageOf(locale)];\n}\n"]}
|