@momentra/angular 0.0.0-stage → 0.1.0-alpha.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.
package/llms.txt ADDED
@@ -0,0 +1,42 @@
1
+ # Momentra (momentra)
2
+
3
+ > Angular 22+ date and time component library: date input, date picker, time picker, date-time picker, date-time input, date range picker and inline calendars. Standalone components, signals, OnPush, Reactive and template-driven forms, pluggable date adapters (native Date, date-fns, Luxon), Intl-based localization, and theming through CSS custom properties (`--mtr-*`) with light, dark and auto themes.
4
+
5
+ Key facts for code generation:
6
+
7
+ - Install: `npm i @momentra/angular @angular/cdk`. No global stylesheet to import; component styles are encapsulated.
8
+ - Configure once: `provideMomentra({ theme: 'auto', locale: 'en-US' })` in `bootstrapApplication` providers.
9
+ - Components are standalone; import the class (e.g. `DatePickerComponent`) into your component's `imports`.
10
+ - Selectors use the `mtr-` prefix: `mtr-date-input`, `mtr-date-picker`, `mtr-time-picker`, `mtr-datetime-picker`, `mtr-datetime-input`, `mtr-date-range-picker`, `mtr-calendar`, `mtr-infinite-calendar`, `mtr-multiview-calendar`, `mtr-month-picker`, `mtr-year-picker`, `mtr-decade-picker`.
11
+ - Values are two-way via `[(value)]` (signal model) or `formControl` / `ngModel`. With the default adapter the value type is `Date`.
12
+ - Always pass `ariaLabel` (or associate a `<label>`) so the field has an accessible name.
13
+ - Theme: `theme` input per component (`'light' | 'dark' | 'auto'`), or set the global `MomentraSettings.theme` signal at runtime.
14
+ - Styling: override `--mtr-*` custom properties on `:root` (popups render in the CDK overlay, so ancestors other than `:root`/`body` do not reach them). Never target internal `.mtr-*` classes or use `::ng-deep`; use `cellTemplate` for custom day content.
15
+ - Date adapters: `@momentra/angular/date-fns` (`provideMomentraDateFns(config)`) and `@momentra/angular/luxon` (`provideMomentraLuxon(config)`) are optional secondary entry points that replace `provideMomentra`.
16
+
17
+ ## Docs
18
+
19
+ - [Full documentation in one file](llms-full.txt): README plus every guide below, concatenated
20
+ - [Component APIs](https://github.com/oscarandrespabonestrella/momentra/blob/main/docs/components.md): inputs, outputs and methods of every component, plus global configuration
21
+ - [Styling and themes](https://github.com/oscarandrespabonestrella/momentra/blob/main/docs/styling-and-themes.md): themes, every `--mtr-*` custom property with light/dark defaults
22
+ - [Localization](https://github.com/oscarandrespabonestrella/momentra/blob/main/docs/localization.md): locales, formats, first day of week, labels
23
+ - [Dates and time zones](https://github.com/oscarandrespabonestrella/momentra/blob/main/docs/dates-and-time-zones.md): how values are represented and compared
24
+ - [Date adapters](https://github.com/oscarandrespabonestrella/momentra/blob/main/docs/date-adapters.md): native, date-fns, Luxon, writing your own
25
+ - [Validation](https://github.com/oscarandrespabonestrella/momentra/blob/main/docs/validation.md): `MomentraValidators`, min/max, disabled dates, error messages
26
+ - [Accessibility](https://github.com/oscarandrespabonestrella/momentra/blob/main/docs/accessibility.md): keyboard map, ARIA, focus behaviour
27
+
28
+ ## Examples
29
+
30
+ - [Basic date picker](https://github.com/oscarandrespabonestrella/momentra/blob/main/examples/basic-date-picker.ts)
31
+ - [Reactive form](https://github.com/oscarandrespabonestrella/momentra/blob/main/examples/reactive-form.ts)
32
+ - [Date range with presets](https://github.com/oscarandrespabonestrella/momentra/blob/main/examples/date-range-with-presets.ts)
33
+ - [Custom cell template](https://github.com/oscarandrespabonestrella/momentra/blob/main/examples/custom-cell-template.ts)
34
+ - [Global config](https://github.com/oscarandrespabonestrella/momentra/blob/main/examples/global-config.ts)
35
+ - [date-fns adapter](https://github.com/oscarandrespabonestrella/momentra/blob/main/examples/date-fns-adapter.ts)
36
+ - [Luxon adapter](https://github.com/oscarandrespabonestrella/momentra/blob/main/examples/luxon-adapter.ts)
37
+
38
+ ## Optional
39
+
40
+ - [Architecture](https://github.com/oscarandrespabonestrella/momentra/blob/main/docs/architecture.md): layers, calendar engine, forms integration, extension points
41
+ - [Contributing](https://github.com/oscarandrespabonestrella/momentra/blob/main/CONTRIBUTING.md): engineering rules for changes to the library itself
42
+ - [Changelog](https://github.com/oscarandrespabonestrella/momentra/blob/main/CHANGELOG.md)
package/package.json CHANGED
@@ -1,6 +1,69 @@
1
1
  {
2
+ "description": "Momentra is a modern, extensible Angular date and time component library providing beautiful, accessible, and highly configurable date pickers, calendars, time pickers, date-time pickers, and date range components.",
3
+ "keywords": [
4
+ "angular",
5
+ "date picker",
6
+ "datepicker",
7
+ "time picker",
8
+ "datetime",
9
+ "date range",
10
+ "calendar",
11
+ "momentra"
12
+ ],
13
+ "license": "MIT",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/oscarandrespabonestrella/momentra.git"
17
+ },
18
+ "bugs": {
19
+ "url": "https://github.com/oscarandrespabonestrella/momentra/issues"
20
+ },
21
+ "homepage": "https://github.com/oscarandrespabonestrella/momentra#readme",
22
+ "publishConfig": {
23
+ "access": "public"
24
+ },
25
+ "peerDependencies": {
26
+ "@angular/cdk": "^22.3.0",
27
+ "@angular/common": "^22.3.0",
28
+ "@angular/core": "^22.3.0",
29
+ "@angular/forms": "^22.3.0",
30
+ "date-fns": "^4.0.0",
31
+ "luxon": "^3.0.0"
32
+ },
33
+ "peerDependenciesMeta": {
34
+ "date-fns": {
35
+ "optional": true
36
+ },
37
+ "luxon": {
38
+ "optional": true
39
+ }
40
+ },
41
+ "dependencies": {
42
+ "tslib": "^2.3.0"
43
+ },
44
+ "sideEffects": false,
2
45
  "name": "@momentra/angular",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
46
+ "type": "module",
47
+ "main": "./fesm2022/momentra-angular.mjs",
48
+ "module": "./fesm2022/momentra-angular.mjs",
49
+ "typings": "./types/momentra-angular.d.ts",
50
+ "types": "./types/momentra-angular.d.ts",
51
+ "exports": {
52
+ ".": {
53
+ "types": "./types/momentra-angular.d.ts",
54
+ "default": "./fesm2022/momentra-angular.mjs"
55
+ },
56
+ "./date-fns": {
57
+ "types": "./types/momentra-angular-date-fns.d.ts",
58
+ "default": "./fesm2022/momentra-angular-date-fns.mjs"
59
+ },
60
+ "./luxon": {
61
+ "types": "./types/momentra-angular-luxon.d.ts",
62
+ "default": "./fesm2022/momentra-angular-luxon.mjs"
63
+ },
64
+ "./package.json": {
65
+ "default": "./package.json"
66
+ }
67
+ },
68
+ "version": "0.1.0-alpha.0"
69
+ }
@@ -0,0 +1,47 @@
1
+ import { EnvironmentProviders } from "@angular/core";
2
+ import { MomentraConfig, MomentraLocale, NativeDateAdapter } from "@momentra/angular";
3
+ import { Locale } from "date-fns";
4
+ /**
5
+ * Date adapter that performs arithmetic, comparison and boundary calculations with
6
+ * [date-fns](https://date-fns.org). Values are plain `Date` objects, so this adapter is a drop-in
7
+ * replacement for the native one in the same applications.
8
+ *
9
+ * Differences from the native adapter: string input is parsed with `parseISO`, so only ISO 8601
10
+ * strings are accepted (bare `yyyy-MM-dd` is still a *local* calendar day).
11
+ */
12
+ export declare class DateFnsDateAdapter extends NativeDateAdapter {
13
+ isValid(date: Date | null | undefined): date is Date;
14
+ deserialize(value: unknown): Date | null;
15
+ addDays(date: Date, amount: number): Date;
16
+ addMonths(date: Date, amount: number): Date;
17
+ addYears(date: Date, amount: number): Date;
18
+ compare(a: Date, b: Date): number;
19
+ isSameDay(a: Date | null | undefined, b: Date | null | undefined): boolean;
20
+ isSameMonth(a: Date | null | undefined, b: Date | null | undefined): boolean;
21
+ isSameYear(a: Date | null | undefined, b: Date | null | undefined): boolean;
22
+ differenceInDays(to: Date, from: Date): number;
23
+ getDaysInMonth(date: Date): number;
24
+ startOfDay(date: Date): Date;
25
+ endOfDay(date: Date): Date;
26
+ startOfMonth(date: Date): Date;
27
+ endOfMonth(date: Date): Date;
28
+ startOfYear(date: Date): Date;
29
+ endOfYear(date: Date): Date;
30
+ startOfWeek(date: Date, firstDayOfWeek: number): Date;
31
+ endOfWeek(date: Date, firstDayOfWeek: number): Date;
32
+ }
33
+ /**
34
+ * Builds a {@link MomentraLocale} from a date-fns locale object, so month/weekday names, the first
35
+ * day of the week and default formats come from date-fns.
36
+ *
37
+ * ```ts
38
+ * import { es } from 'date-fns/locale';
39
+ * provideMomentraDateFns({ locale: momentraLocaleFromDateFns('es-ES', es) })
40
+ * ```
41
+ */
42
+ export declare function momentraLocaleFromDateFns(code: string, locale: Locale, overrides?: Partial<MomentraLocale>): MomentraLocale;
43
+ /**
44
+ * Configures Momentra to use the date-fns adapter. Equivalent to
45
+ * `provideMomentra({ ...config, dateAdapter: DateFnsDateAdapter })`.
46
+ */
47
+ export declare function provideMomentraDateFns(config?: Partial<Omit<MomentraConfig, 'dateAdapter'>>): EnvironmentProviders;
@@ -0,0 +1,48 @@
1
+ import { EnvironmentProviders } from "@angular/core";
2
+ import { DateAdapter, MomentraConfig } from "@momentra/angular";
3
+ import { DateTime } from "luxon";
4
+ interface LuxonDateAdapterOptions {
5
+ /**
6
+ * IANA zone (`'Europe/Madrid'`, `'UTC'`) in which dates are created and read. Defaults to the
7
+ * system zone. Calendar fields (year, month, day, hour…) always refer to this zone.
8
+ */
9
+ zone?: string;
10
+ }
11
+ /**
12
+ * Date adapter for [Luxon](https://moment.github.io/luxon/) `DateTime` values, with optional
13
+ * fixed-zone support for time-zone-aware workflows.
14
+ *
15
+ * Values are zoned `DateTime`s: the calendar fields the picker shows are the fields **in the
16
+ * adapter's zone**, regardless of the user's system zone.
17
+ */
18
+ export declare class LuxonDateAdapter extends DateAdapter<DateTime> {
19
+ private readonly zone;
20
+ constructor(options?: LuxonDateAdapterOptions);
21
+ now(): DateTime;
22
+ create(year: number, month: number, day: number, hours?: number, minutes?: number, seconds?: number, milliseconds?: number): DateTime;
23
+ clone(date: DateTime): DateTime;
24
+ invalid(): DateTime;
25
+ isValid(date: DateTime | null | undefined): date is DateTime;
26
+ deserialize(value: unknown): DateTime | null;
27
+ getYear(date: DateTime): number;
28
+ getMonth(date: DateTime): number;
29
+ getDate(date: DateTime): number;
30
+ getDayOfWeek(date: DateTime): number;
31
+ getHours(date: DateTime): number;
32
+ getMinutes(date: DateTime): number;
33
+ getSeconds(date: DateTime): number;
34
+ getMilliseconds(date: DateTime): number;
35
+ toTimestamp(date: DateTime): number;
36
+ addDays(date: DateTime, amount: number): DateTime;
37
+ private inZone;
38
+ }
39
+ /**
40
+ * Configures Momentra to use Luxon `DateTime` values. Pass `adapter.zone` to work in a fixed IANA
41
+ * time zone instead of the system zone.
42
+ *
43
+ * ```ts
44
+ * provideMomentraLuxon({ locale: 'es-ES' }, { zone: 'Europe/Madrid' })
45
+ * ```
46
+ */
47
+ export declare function provideMomentraLuxon(config?: Partial<Omit<MomentraConfig, 'dateAdapter'>>, adapter?: LuxonDateAdapterOptions): EnvironmentProviders;
48
+ export type { LuxonDateAdapterOptions };