@astryxdesign/core 0.7.9-canary.d8387c5 → 0.7.9-canary.e2b522f

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.
@@ -66,14 +66,15 @@ export interface InternationalizationProviderProps {
66
66
  dir?: 'ltr' | 'rtl';
67
67
  /**
68
68
  * The calendar system of this subtree, such as `'persian'` or `'hebrew'`.
69
- * `Calendar` shows it, and Timestamp and PowerSearch write their dates in it.
70
- * The date inputs show Gregorian dates. Values stay Gregorian ISO dates. When
71
- * omitted, the calendar is Gregorian: a locale never selects it, neither by
72
- * its default calendar nor by a `-u-ca-` keyword. A component's own
73
- * `calendar` prop takes precedence. Calendars other than `gregory`,
74
- * `iso8601`, `buddhist`, `roc`, and `japanese` need `Temporal`. The context
75
- * keeps the requested calendar; where `Temporal` is missing, these components
76
- * show Gregorian dates and warn once in development.
69
+ * `Calendar` shows it, and Timestamp, PowerSearch, and Lab's Schedule write
70
+ * their dates in it. The date inputs show Gregorian dates. Values stay
71
+ * Gregorian ISO dates. When omitted, the calendar is Gregorian: a locale
72
+ * never selects it, neither by its default calendar nor by a `-u-ca-`
73
+ * keyword. A component's own `calendar` prop takes precedence. Calendars
74
+ * other than `gregory`, `iso8601`, `buddhist`, `roc`, and `japanese` need
75
+ * `Temporal`. The context keeps the requested calendar; where `Temporal` is
76
+ * missing, these components show Gregorian dates and warn once in
77
+ * development.
77
78
  *
78
79
  * @example
79
80
  * ```
@@ -1 +1 @@
1
- {"version":3,"file":"InternationalizationProvider.d.ts","sourceRoot":"","sources":["../../src/i18n/InternationalizationProvider.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAI9C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EACV,MAAM,EAEN,SAAS,EACT,wBAAwB,EACzB,MAAM,SAAS,CAAC;AA4BjB,MAAM,WAAW,iCAAiC;IAChD;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB;;;;;;;;;;;;;;;OAeG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,QAAQ,EACR,SAAS,EACT,GAAG,EACH,QAAQ,EAAE,YAAY,EACtB,QAAQ,GACT,EAAE,iCAAiC,+BAyBnC;yBAhCe,4BAA4B"}
1
+ {"version":3,"file":"InternationalizationProvider.d.ts","sourceRoot":"","sources":["../../src/i18n/InternationalizationProvider.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAI9C,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EACV,MAAM,EAEN,SAAS,EACT,wBAAwB,EACzB,MAAM,SAAS,CAAC;AA4BjB,MAAM,WAAW,iCAAiC;IAChD;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,EAAE,wBAAwB,CAAC;IACpC;;;;;;;;;;OAUG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;;;;;;;;OAWG;IACH,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,MAAM,EACN,QAAQ,EACR,SAAS,EACT,GAAG,EACH,QAAQ,EAAE,YAAY,EACtB,QAAQ,GACT,EAAE,iCAAiC,+BAyBnC;yBAhCe,4BAA4B"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @file calendar-system.ts
3
+ * @input The i18n calendar resolution
4
+ * @output `@astryxdesign/core/internal/calendar-system`: the hook that
5
+ * resolves the calendar a date component shows, and the helpers that name
6
+ * its months and days as Core's Calendar does, for Lab components
7
+ * @position An internal entry reserved for Astryx's own packages:
8
+ * undocumented, outside the public API and its compatibility promise,
9
+ * versioned in lockstep with Core, and allowed only in Core and Lab by the
10
+ * `@astryx/no-core-internal-import` lint rule. Named re-exports only.
11
+ *
12
+ * SYNC: When modified, update calendar-system.test.ts and
13
+ * scripts/sync-exports.js.
14
+ */
15
+ export { useCalendarSystem } from '../i18n/useCalendarSystem.js';
16
+ export { calendarMonthLabelDay, calendarMonthOf, formatCalendarDate, formatCalendarDateToParts, formatCalendarInstantRange, } from '../utils/calendarSystem.js';
17
+ export type { CalendarSystem } from '../utils/calendarSystem.js';
18
+ //# sourceMappingURL=calendar-system.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-system.d.ts","sourceRoot":"","sources":["../../src/internal/calendar-system.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAC,cAAc,EAAC,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,19 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file calendar-system.ts
5
+ * @input The i18n calendar resolution
6
+ * @output `@astryxdesign/core/internal/calendar-system`: the hook that
7
+ * resolves the calendar a date component shows, and the helpers that name
8
+ * its months and days as Core's Calendar does, for Lab components
9
+ * @position An internal entry reserved for Astryx's own packages:
10
+ * undocumented, outside the public API and its compatibility promise,
11
+ * versioned in lockstep with Core, and allowed only in Core and Lab by the
12
+ * `@astryx/no-core-internal-import` lint rule. Named re-exports only.
13
+ *
14
+ * SYNC: When modified, update calendar-system.test.ts and
15
+ * scripts/sync-exports.js.
16
+ */
17
+
18
+ export { useCalendarSystem } from "../i18n/useCalendarSystem.js";
19
+ export { calendarMonthLabelDay, calendarMonthOf, formatCalendarDate, formatCalendarDateToParts, formatCalendarInstantRange } from "../utils/calendarSystem.js";
@@ -0,0 +1,108 @@
1
+ /**
2
+ * @file calendarDateParser.ts
3
+ * @input Date text, locale, calendar; Intl, calendarSystem, unicodeDigits
4
+ * @output Cached per-locale lexicons, a typed-date parser with distinct rejection
5
+ * kinds, committed display text, the format hint, and calendar display names
6
+ * @position Core utility; reads and writes dates typed in a calendar system
7
+ *
8
+ * SYNC: When modified, update:
9
+ * - /packages/core/src/utils/calendarDateParser.test.ts
10
+ * - /packages/core/src/utils/calendarDateParser.roundtrip.test.ts
11
+ */
12
+ import type { PlainDate } from './dateTypes.js';
13
+ import type { Locale } from '../i18n/types.js';
14
+ import { type CalendarSystem } from './calendarSystem.js';
15
+ import { type SharedDateFormat } from './plainDate.js';
16
+ /** How a typed text reads in a calendar. */
17
+ export type CalendarDateParseResult = {
18
+ readonly kind: 'empty';
19
+ }
20
+ /** Part of a date: nothing to report yet. */
21
+ | {
22
+ readonly kind: 'incomplete';
23
+ }
24
+ /** Text that cannot become a date. */
25
+ | {
26
+ readonly kind: 'unreadable';
27
+ }
28
+ /** A readable date that the calendar does not have. */
29
+ | {
30
+ readonly kind: 'nonexistent';
31
+ readonly isComplete: boolean;
32
+ }
33
+ /** A date that the constraints reject. */
34
+ | {
35
+ readonly kind: 'outOfRange';
36
+ readonly date: PlainDate;
37
+ readonly isComplete: boolean;
38
+ }
39
+ /**
40
+ * A date. `isComplete` is true when more typing cannot change its meaning,
41
+ * so a field may report it while the person types.
42
+ */
43
+ | {
44
+ readonly kind: 'value';
45
+ readonly date: PlainDate;
46
+ readonly isComplete: boolean;
47
+ };
48
+ export interface CalendarDateParseOptions {
49
+ /** The Gregorian date that two-digit and omitted years resolve against. */
50
+ readonly today?: PlainDate;
51
+ /** Reads ISO-shaped text as a Gregorian ISO date, as `system_date` shows. */
52
+ readonly isoIsGregorian?: boolean;
53
+ /** Returns true for a date that may not be chosen. */
54
+ readonly isDateDisabled?: (date: PlainDate) => boolean;
55
+ }
56
+ type DateField = 'year' | 'month' | 'day';
57
+ interface EraArithmetic {
58
+ /** The Gregorian year before era year 1, or after it for a backward era. */
59
+ readonly base: number;
60
+ readonly isForward: boolean;
61
+ }
62
+ /** What a locale writes for one calendar, learned from Intl. */
63
+ export interface CalendarDateLexicon {
64
+ readonly locale: Locale;
65
+ readonly calendar: CalendarSystem;
66
+ readonly order: ReadonlyArray<DateField>;
67
+ readonly nameOrder: ReadonlyArray<DateField>;
68
+ readonly months: ReadonlyMap<string, ReadonlySet<string>>;
69
+ readonly monthTemplates: ReadonlyArray<MonthTemplate>;
70
+ readonly leapMarkers: ReadonlySet<string>;
71
+ readonly eras: ReadonlyMap<string, string>;
72
+ readonly yearAliases: ReadonlyMap<string, string>;
73
+ readonly trailers: ReadonlySet<string>;
74
+ readonly weekdays: ReadonlySet<string>;
75
+ readonly vocabulary: ReadonlyArray<string>;
76
+ readonly vocabularySet: ReadonlySet<string>;
77
+ readonly isNumericMonthOrdinal: boolean;
78
+ readonly eraArithmetic: ReadonlyMap<string, EraArithmetic>;
79
+ }
80
+ interface MonthTemplate {
81
+ readonly pre: string;
82
+ readonly post: string;
83
+ readonly isLeap: boolean;
84
+ }
85
+ /** Text in one comparable form: ASCII digits, lower case, no Latin accents. */
86
+ export declare function normalizeDateText(text: string, locale: Locale): string;
87
+ /**
88
+ * The lexicon for a locale and calendar, built on first use and cached.
89
+ * Building one formats a few hundred dates; call it when a field gains focus.
90
+ */
91
+ export declare function getCalendarDateLexicon(locale: Locale, calendar: CalendarSystem): CalendarDateLexicon;
92
+ /**
93
+ * Reads typed text as a date in the lexicon's calendar. Values are Gregorian.
94
+ * The result tells an empty field, part of a date, unreadable text, a date the
95
+ * calendar does not have, a date out of range, and a date apart.
96
+ */
97
+ export declare function parseCalendarDate(text: string, lex: CalendarDateLexicon, options?: CalendarDateParseOptions): CalendarDateParseResult;
98
+ /**
99
+ * The committed text of a date field in a calendar. Gregorian text is the
100
+ * shared Timestamp date text; `system_date` is always the ISO date.
101
+ */
102
+ export declare function formatCalendarDateText(pd: PlainDate, format: SharedDateFormat, locale: Locale, calendar: CalendarSystem): string;
103
+ /** An example date in the calendar's numeric pattern, with its era. */
104
+ export declare function formatCalendarDateHint(pd: PlainDate, locale: Locale, calendar: CalendarSystem): string;
105
+ /** The calendar's name in the locale, such as "Persian Calendar". */
106
+ export declare function calendarDisplayName(calendar: CalendarSystem, locale: Locale): string;
107
+ export {};
108
+ //# sourceMappingURL=calendarDateParser.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendarDateParser.d.ts","sourceRoot":"","sources":["../../src/utils/calendarDateParser.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EACL,KAAK,cAAc,EAQpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,gBAAgB,EAStB,MAAM,aAAa,CAAC;AAGrB,4CAA4C;AAC5C,MAAM,MAAM,uBAAuB,GAC/B;IAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;CAAC;AAC1B,6CAA6C;GAC3C;IAAC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAC;AAC/B,sCAAsC;GACpC;IAAC,QAAQ,C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