@fragiola/primitives 0.0.0-stage → 0.0.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/LICENSE +21 -0
- package/README.md +50 -2
- package/dist/async-list-Bv6ff5Oj.js +81 -0
- package/dist/async-list-Bv6ff5Oj.js.map +1 -0
- package/dist/async-list.d.ts +2 -0
- package/dist/async-list.js +1 -0
- package/dist/calendar-keys-DGYpjLwv.d.ts +12 -0
- package/dist/calendar-system-B5U5HcPQ.d.ts +415 -0
- package/dist/calendar-systems-Daa6Q_ca.js +659 -0
- package/dist/calendar-systems-Daa6Q_ca.js.map +1 -0
- package/dist/calendar-systems.d.ts +3 -0
- package/dist/calendar-systems.js +1 -0
- package/dist/carousel-LRbWqbAx.js +375 -0
- package/dist/carousel-LRbWqbAx.js.map +1 -0
- package/dist/carousel.d.ts +2 -0
- package/dist/carousel.js +1 -0
- package/dist/cascade-B155Xvvv.js +64 -0
- package/dist/cascade-B155Xvvv.js.map +1 -0
- package/dist/cascade.d.ts +2 -0
- package/dist/cascade.js +1 -0
- package/dist/clipboard-Cy2cbGEW.js +33 -0
- package/dist/clipboard-Cy2cbGEW.js.map +1 -0
- package/dist/clipboard.d.ts +2 -0
- package/dist/clipboard.js +1 -0
- package/dist/collection-Dbk-PB5S.js +609 -0
- package/dist/collection-Dbk-PB5S.js.map +1 -0
- package/dist/collection.d.ts +2 -0
- package/dist/collection.js +3 -0
- package/dist/color-sURV5Irg.js +699 -0
- package/dist/color-sURV5Irg.js.map +1 -0
- package/dist/color.d.ts +2 -0
- package/dist/color.js +1 -0
- package/dist/command-DueCXi65.js +104 -0
- package/dist/command-DueCXi65.js.map +1 -0
- package/dist/command.d.ts +2 -0
- package/dist/command.js +1 -0
- package/dist/date-CrbFSJKQ.js +215 -0
- package/dist/date-CrbFSJKQ.js.map +1 -0
- package/dist/date.d.ts +4 -0
- package/dist/date.js +1 -0
- package/dist/direction-CTnVLpmd.d.ts +8 -0
- package/dist/direction-DJDPvnxJ.js +13 -0
- package/dist/direction-DJDPvnxJ.js.map +1 -0
- package/dist/direction.d.ts +2 -0
- package/dist/direction.js +1 -0
- package/dist/drag-session-CSr06B5v.js +41 -0
- package/dist/drag-session-CSr06B5v.js.map +1 -0
- package/dist/file-DSLtfzbi.js +263 -0
- package/dist/file-DSLtfzbi.js.map +1 -0
- package/dist/file.d.ts +2 -0
- package/dist/file.js +1 -0
- package/dist/focus-BI-VvM0f.js +75 -0
- package/dist/focus-BI-VvM0f.js.map +1 -0
- package/dist/focus.d.ts +2 -0
- package/dist/focus.js +3 -0
- package/dist/form-DovwKtqz.js +501 -0
- package/dist/form-DovwKtqz.js.map +1 -0
- package/dist/form.d.ts +2 -0
- package/dist/form.js +1 -0
- package/dist/hover-BakyPYnC.js +62 -0
- package/dist/hover-BakyPYnC.js.map +1 -0
- package/dist/hover.d.ts +2 -0
- package/dist/hover.js +1 -0
- package/dist/id-B0Y8iZrc.js +13 -0
- package/dist/id-B0Y8iZrc.js.map +1 -0
- package/dist/id.d.ts +2 -0
- package/dist/id.js +1 -0
- package/dist/image-D4X_yRYw.js +44 -0
- package/dist/image-D4X_yRYw.js.map +1 -0
- package/dist/image.d.ts +2 -0
- package/dist/image.js +1 -0
- package/dist/index-B0rwIZw9.d.ts +51 -0
- package/dist/index-B4wF1isn.d.ts +128 -0
- package/dist/index-BHiBRE01.d.ts +20 -0
- package/dist/index-BNlMm-0u.d.ts +17 -0
- package/dist/index-BapNrjY9.d.ts +48 -0
- package/dist/index-Bd-tVb7C.d.ts +6 -0
- package/dist/index-BjE8nDiX.d.ts +125 -0
- package/dist/index-BpbT-FsX.d.ts +117 -0
- package/dist/index-CBgGcTeX.d.ts +37 -0
- package/dist/index-CGThV_Md.d.ts +100 -0
- package/dist/index-CMig3TXL.d.ts +28 -0
- package/dist/index-CWFRduRd.d.ts +212 -0
- package/dist/index-CkrHWyU_.d.ts +33 -0
- package/dist/index-Cwu6f7y1.d.ts +18 -0
- package/dist/index-D10LDdR6.d.ts +139 -0
- package/dist/index-D146vm21.d.ts +104 -0
- package/dist/index-DGKhEvNr.d.ts +107 -0
- package/dist/index-DbAu4s16.d.ts +48 -0
- package/dist/index-DdaCj6IO.d.ts +54 -0
- package/dist/index-DeHcNdjC.d.ts +68 -0
- package/dist/index-DeR4ncrW.d.ts +93 -0
- package/dist/index-HIksgK0e.d.ts +70 -0
- package/dist/index-IZB0mlZl.d.ts +71 -0
- package/dist/index-IfDZj87U.d.ts +28 -0
- package/dist/index-SrTuVBms.d.ts +75 -0
- package/dist/index-T9UcYvkf.d.ts +339 -0
- package/dist/index-fRTojAoR.d.ts +31 -0
- package/dist/index-fuLUke9n.d.ts +6 -0
- package/dist/index-l63esAck.d.ts +104 -0
- package/dist/index-raSUg9U7.d.ts +38 -0
- package/dist/index-twgzPKvZ.d.ts +278 -0
- package/dist/index-wBpjRykh.d.ts +125 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +42 -0
- package/dist/inert-DlGToy3q.js +80 -0
- package/dist/inert-DlGToy3q.js.map +1 -0
- package/dist/inert.d.ts +2 -0
- package/dist/inert.js +1 -0
- package/dist/layer-stack-BEtzaFC1.js +118 -0
- package/dist/layer-stack-BEtzaFC1.js.map +1 -0
- package/dist/layers-C-N4rrZX.js +24 -0
- package/dist/layers-C-N4rrZX.js.map +1 -0
- package/dist/layers.d.ts +2 -0
- package/dist/layers.js +3 -0
- package/dist/list-navigation-CbWv4DK5.js +40 -0
- package/dist/list-navigation-CbWv4DK5.js.map +1 -0
- package/dist/month-year-BG5imFUq.js +108 -0
- package/dist/month-year-BG5imFUq.js.map +1 -0
- package/dist/month-year.d.ts +3 -0
- package/dist/month-year.js +1 -0
- package/dist/number-BFUio97d.js +316 -0
- package/dist/number-BFUio97d.js.map +1 -0
- package/dist/number.d.ts +2 -0
- package/dist/number.js +1 -0
- package/dist/overlay-BwPyiM3T.js +78 -0
- package/dist/overlay-BwPyiM3T.js.map +1 -0
- package/dist/overlay.d.ts +2 -0
- package/dist/overlay.js +1 -0
- package/dist/pagination-BkVzaIGP.js +51 -0
- package/dist/pagination-BkVzaIGP.js.map +1 -0
- package/dist/pagination.d.ts +2 -0
- package/dist/pagination.js +1 -0
- package/dist/plain-date-idQH1P6X.d.ts +29 -0
- package/dist/plain-date-time-B8PGahhe.d.ts +99 -0
- package/dist/pointer-CuDtD9XA.js +189 -0
- package/dist/pointer-CuDtD9XA.js.map +1 -0
- package/dist/pointer.d.ts +2 -0
- package/dist/pointer.js +3 -0
- package/dist/positioning-DDUQ75mB.js +148 -0
- package/dist/positioning-DDUQ75mB.js.map +1 -0
- package/dist/positioning.d.ts +2 -0
- package/dist/positioning.js +1 -0
- package/dist/presence-BhKDOmII.js +86 -0
- package/dist/presence-BhKDOmII.js.map +1 -0
- package/dist/presence.d.ts +2 -0
- package/dist/presence.js +1 -0
- package/dist/range-o0_GBhyY.js +158 -0
- package/dist/range-o0_GBhyY.js.map +1 -0
- package/dist/range.d.ts +2 -0
- package/dist/range.js +1 -0
- package/dist/scroll-area-BYNhv36t.js +447 -0
- package/dist/scroll-area-BYNhv36t.js.map +1 -0
- package/dist/scroll-area.d.ts +2 -0
- package/dist/scroll-area.js +1 -0
- package/dist/scroll-lock-JzRNOA1O.js +42 -0
- package/dist/scroll-lock-JzRNOA1O.js.map +1 -0
- package/dist/scroll-lock.d.ts +2 -0
- package/dist/scroll-lock.js +1 -0
- package/dist/segments-eRu5G_Bd.js +587 -0
- package/dist/segments-eRu5G_Bd.js.map +1 -0
- package/dist/segments.d.ts +3 -0
- package/dist/segments.js +1 -0
- package/dist/selection-Cor67w_V.js +287 -0
- package/dist/selection-Cor67w_V.js.map +1 -0
- package/dist/selection.d.ts +2 -0
- package/dist/selection.js +1 -0
- package/dist/swipe.d.ts +2 -0
- package/dist/swipe.js +1 -0
- package/dist/tabbable-BPiLssIv.js +35 -0
- package/dist/tabbable-BPiLssIv.js.map +1 -0
- package/dist/time-Ct6oq9kt.js +208 -0
- package/dist/time-Ct6oq9kt.js.map +1 -0
- package/dist/time-zone-DegkzwST.js +305 -0
- package/dist/time-zone-DegkzwST.js.map +1 -0
- package/dist/time-zone.d.ts +2 -0
- package/dist/time-zone.js +1 -0
- package/dist/time.d.ts +2 -0
- package/dist/time.js +1 -0
- package/dist/toast-BjRpJalM.js +400 -0
- package/dist/toast-BjRpJalM.js.map +1 -0
- package/dist/toast.d.ts +2 -0
- package/dist/toast.js +1 -0
- package/dist/unit-grid-DJy8lb5D.d.ts +21 -0
- package/dist/virtual-BlX1RuHD.js +306 -0
- package/dist/virtual-BlX1RuHD.js.map +1 -0
- package/dist/virtual.d.ts +2 -0
- package/dist/virtual.js +1 -0
- package/dist/watch-swipe-BIucfr9O.js +301 -0
- package/dist/watch-swipe-BIucfr9O.js.map +1 -0
- package/package.json +234 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calendar-systems-Daa6Q_ca.js","names":[],"sources":["../src/calendar-systems/epoch-day.ts","../src/calendar-systems/calendar-units.ts","../src/calendar-systems/segment-hooks.ts","../src/calendar-systems/calendar-system.ts","../src/calendar-systems/intl-engine.ts","../src/calendar-systems/iso-engine.ts","../src/calendar-systems/japanese-eras.ts","../src/calendar-systems/systems.ts"],"sourcesContent":["import type { PlainDate } from \"../date/plain-date.ts\";\n\nconst DAY = 86_400_000;\n\n/** A UTC `Date` at midnight of an ISO date, years 0–99 included (`Date.UTC` reads them as 19xx). */\nexport function utcMidnight(date: PlainDate): Date {\n const utc = new Date(0);\n utc.setUTCFullYear(date.year, date.month - 1, date.day);\n return utc;\n}\n\n/** The days from 1970-01-01 to an ISO date. */\nexport function toEpochDay(date: PlainDate): number {\n return Math.round(utcMidnight(date).getTime() / DAY);\n}\n\n/** The date `days` later (the `/date` math, kept here: this entry imports no other's code). */\nexport function addDays(date: PlainDate, days: number): PlainDate {\n return fromEpochDay(toEpochDay(date) + days);\n}\n\n/** The first day of the date's week, given the locale's first day (0 = Sunday). */\nexport function startOfWeek(\n date: PlainDate,\n firstDayOfWeek: number,\n): PlainDate {\n const day = toEpochDay(date);\n // 1970-01-01 was a Thursday (4)\n const weekday = (((day + 4) % 7) + 7) % 7;\n return fromEpochDay(day - ((weekday - firstDayOfWeek + 7) % 7));\n}\n\n/** The ISO date `days` after 1970-01-01. */\nexport function fromEpochDay(days: number): PlainDate {\n const utc = new Date(days * DAY);\n return {\n year: utc.getUTCFullYear(),\n month: utc.getUTCMonth() + 1,\n day: utc.getUTCDate(),\n };\n}\n","import type { PlainDate } from \"../date/plain-date.ts\";\nimport type { UnitKeyOptions } from \"../month-year/unit-grid.ts\";\nimport type { CalendarSystem } from \"./calendar-system.ts\";\nimport { fromEpochDay, toEpochDay } from \"./epoch-day.ts\";\n\n/** A month or a year of a calendar system: `{ year, month }`, or `{ year }`. */\nexport interface CalendarUnit {\n readonly year: number;\n readonly month?: number;\n}\n\n/**\n * The items of a month or year calendar in a calendar system (spec/calendar-systems.md, \"Month and\n * year calendars\"), as numbers: a month's `monthIndex` (a page is its year: 12 or 13 months), or\n * the year (a page of 12 from a multiple of 12, as the ISO calendar's).\n */\nexport interface CalendarUnits {\n /** The number of a month or year. */\n index(item: CalendarUnit): number;\n /** The month or year of a number. */\n item(index: number): CalendarUnit;\n /** The first item of the page holding `index`. */\n pageStart(index: number): number;\n /** How many items the page starting at `start` holds. */\n pageSize(start: number): number;\n /** The first item of the next (`1`) or previous (`-1`) page (a year can have 13 months). */\n page(start: number, delta: 1 | -1): number;\n /** Today's month or year (the page's local date). */\n today(): number;\n /** The page starting at `start`, in rows of `columns`. */\n rows(start: number, columns: number): number[][];\n /** The item a key moves to (the ISO calendar's `unitKeyTarget`, a page being a year). */\n keyTarget(\n key: string,\n focused: number,\n options: UnitKeyOptions,\n ): number | null;\n /** The month or year of an ISO date. */\n fromDate(date: PlainDate): number;\n /** The ISO dates of a month or year. */\n days(index: number): PlainDate[];\n /**\n * A CalendarView's choice of a month or year: its enabled day nearest to the focused date's\n * place in it (the same day of the month, the same month and day of the year); `undefined`\n * when every day is disabled.\n */\n nearest(\n index: number,\n focused: PlainDate,\n enabled: (date: PlainDate) => boolean,\n ): PlainDate | undefined;\n /** A month's cell content (\"Azar\"), a year's (\"1405\"). */\n text(locale: string, index: number): string;\n /** A cell's name (\"Azar 1405\", \"1405\"). */\n name(locale: string, index: number): string;\n /** The page's heading: the year of a month page, the span of a year page (\"1395 – 1406\"). */\n heading(locale: string, start: number): string;\n /**\n * The form's text: the ISO date of the first day with the system (RFC 9557, Temporal's\n * `toString` of a non-ISO month): `2026-10-23[u-ca=persian]`.\n */\n iso(index: number): string;\n}\n\nconst pad = (value: number, size: number) =>\n String(Math.abs(value)).padStart(size, \"0\");\n\nfunction isoText(date: PlainDate, id: string): string {\n return `${date.year < 0 ? \"-\" : \"\"}${pad(date.year, 4)}-${pad(date.month, 2)}-${pad(date.day, 2)}[u-ca=${id}]`;\n}\n\n/** Today, in the page's local time. */\nfunction localToday(): PlainDate {\n const now = new Date();\n return {\n year: now.getFullYear(),\n month: now.getMonth() + 1,\n day: now.getDate(),\n };\n}\n\nfunction between(first: PlainDate, next: PlainDate): PlainDate[] {\n const start = toEpochDay(first);\n return Array.from({ length: toEpochDay(next) - start }, (_, offset) =>\n fromEpochDay(start + offset),\n );\n}\n\n/** The enabled day of `days` nearest to `place`. */\nfunction nearestDay(\n days: PlainDate[],\n place: PlainDate,\n enabled: (date: PlainDate) => boolean,\n): PlainDate | undefined {\n const at = toEpochDay(place);\n const distance = (date: PlainDate) => Math.abs(toEpochDay(date) - at);\n return days.filter(enabled).sort((a, b) => distance(a) - distance(b))[0];\n}\n\n/** A year page's size: 12 years from a multiple of 12, as the ISO calendar's (`/month-year`). */\nconst YEARS = 12;\n\n/** A page of `count` items from `start`, in rows of `columns`. */\nfunction rowsOf(start: number, count: number, columns: number): number[][] {\n const size = Math.max(1, Math.floor(columns));\n const rows: number[][] = [];\n for (let offset = 0; offset < count; offset += size) {\n rows.push(\n Array.from(\n { length: Math.min(size, count - offset) },\n (_, column) => start + offset + column,\n ),\n );\n }\n return rows;\n}\n\n/**\n * The item a key moves to on a page (`/month-year`'s `unitKeyTarget`, kept here: this entry\n * imports no other's code), Page Up and Down by `pageMove`.\n */\nfunction pagedKeyTarget(\n key: string,\n focused: number,\n { rtl, columns }: UnitKeyOptions,\n page: number,\n count: number,\n pageMove: (delta: 1 | -1) => number,\n): number | null {\n const size = Math.max(1, Math.floor(columns));\n const rowStart = page + Math.floor((focused - page) / size) * size;\n switch (key) {\n case \"ArrowRight\":\n return focused + (rtl ? -1 : 1);\n case \"ArrowLeft\":\n return focused + (rtl ? 1 : -1);\n case \"ArrowDown\":\n return focused + size;\n case \"ArrowUp\":\n return focused - size;\n case \"Home\":\n return rowStart;\n case \"End\":\n return Math.min(rowStart + size, page + count) - 1;\n case \"PageDown\":\n return pageMove(1);\n case \"PageUp\":\n return pageMove(-1);\n default:\n return null;\n }\n}\n\n/** The months of a system, a page being one of its years. */\nexport function monthUnits(system: CalendarSystem): CalendarUnits {\n const yearStart = (index: number) =>\n system.monthIndex({\n year: system.fromMonthIndex(index).year,\n month: 1,\n });\n const pageSize = (start: number) =>\n system.monthsInYear(system.fromMonthIndex(start).year);\n const first = (index: number) =>\n system.monthStart(system.fromMonthIndex(index));\n const fromDate = (date: PlainDate) =>\n system.monthIndex(system.yearMonthOf(date));\n return {\n index: (item) =>\n system.monthIndex({ year: item.year, month: item.month ?? 1 }),\n item: (index) => system.fromMonthIndex(index),\n pageStart: yearStart,\n pageSize,\n page: (start, delta) =>\n delta > 0 ? start + pageSize(start) : yearStart(start - 1),\n today: () => fromDate(localToday()),\n rows: (start, columns) => rowsOf(start, pageSize(start), columns),\n keyTarget: (key, focused, options) => {\n const page = yearStart(focused);\n // the same month of the next or previous year (a leap month to its common year's)\n return pagedKeyTarget(\n key,\n focused,\n options,\n page,\n pageSize(page),\n (delta) =>\n system.monthIndex(\n system.yearMonthOf(\n system.addYears(first(focused), delta),\n ),\n ),\n );\n },\n fromDate,\n days: (index) => between(first(index), first(index + 1)),\n nearest: (index, focused, enabled) =>\n nearestDay(\n between(first(index), first(index + 1)),\n system.fromFields({\n ...system.fromMonthIndex(index),\n day: system.fields(focused).day,\n }),\n enabled,\n ),\n text: (locale, index) =>\n system.format(locale, first(index), { month: \"long\" }),\n name: (locale, index) =>\n system.format(locale, first(index), {\n month: \"long\",\n year: \"numeric\",\n }),\n heading: (locale, start) =>\n system.format(locale, first(start), { year: \"numeric\" }),\n iso: (index) => isoText(first(index), system.id),\n };\n}\n\n/** The years of a system, in pages of 12 from a multiple of 12. */\nexport function yearUnits(system: CalendarSystem): CalendarUnits {\n const first = (year: number) => system.monthStart({ year, month: 1 });\n const pageStart = (year: number) => Math.floor(year / YEARS) * YEARS;\n const fromDate = (date: PlainDate) => system.fields(date).year;\n return {\n index: (item) => item.year,\n item: (index) => ({ year: index }),\n pageStart,\n pageSize: () => YEARS,\n page: (start, delta) => start + delta * YEARS,\n today: () => fromDate(localToday()),\n rows: (start, columns) => rowsOf(start, YEARS, columns),\n keyTarget: (key, focused, options) =>\n pagedKeyTarget(\n key,\n focused,\n options,\n pageStart(focused),\n YEARS,\n (delta) => focused + delta * YEARS,\n ),\n fromDate,\n days: (year) => between(first(year), first(year + 1)),\n nearest: (year, focused, enabled) =>\n nearestDay(\n between(first(year), first(year + 1)),\n system.addYears(focused, year - system.fields(focused).year),\n enabled,\n ),\n text: (locale, year) =>\n system.format(locale, first(year), { year: \"numeric\" }),\n name: (locale, year) =>\n system.format(locale, first(year), { year: \"numeric\" }),\n heading: (locale, start) =>\n system.formatRange(locale, first(start), first(start + YEARS - 1), {\n year: \"numeric\",\n }),\n iso: (year) => isoText(first(year), system.id),\n };\n}\n","import type { PlainDate } from \"../date/plain-date.ts\";\nimport type {\n EditableSegmentType,\n SegmentFormat,\n SegmentType,\n} from \"../segments/segment-format.ts\";\nimport type {\n SegmentRange,\n SegmentValues,\n} from \"../segments/segment-values.ts\";\nimport type { PlainDateTime } from \"../time/plain-date-time.ts\";\nimport type { CalendarSystem } from \"./calendar-system.ts\";\nimport { utcMidnight } from \"./epoch-day.ts\";\n\n// The segments' hooks of a calendar system (spec/calendar-systems.md, \"In the fields\"): what\n// `/segments` calls through a format's `calendar`, so the era, the 13-month years and the system's\n// fields are code of this entry, and a field given no calendar bundles none of it (Epic #88). Each\n// takes the format, whose `calendar` is the system.\n\n/** The system of a format the hooks are called through. */\nfunction systemOf(format: SegmentFormat): CalendarSystem {\n return format.calendar as CalendarSystem;\n}\n\n/**\n * The arithmetic year of the values: the year segment is an era's year where the era is edited\n * (the current era while it is a placeholder), else the system's year; `undefined` while the\n * year is a placeholder.\n */\nfunction calendarYear(\n format: SegmentFormat,\n values: SegmentValues,\n): number | undefined {\n if (values.year === undefined) {\n return undefined;\n }\n return format.eras\n ? systemOf(format).yearOfEra(\n values.era ?? format.eras.length - 1,\n values.year,\n )\n : values.year;\n}\n\n/** The values' year, or a year of the system's longest months while it is a placeholder. */\nfunction sampleYear(format: SegmentFormat, values: SegmentValues): number {\n return calendarYear(format, values) ?? systemOf(format).referenceYear();\n}\n\n/**\n * The format in the system: its era is editable where the system has several (a Japanese date's),\n * with the eras' names (`era: \"short\"`), oldest first.\n */\nexport function segmentCalendarFormat(format: SegmentFormat): SegmentFormat {\n const system = systemOf(format);\n const count = system.eraCount();\n const editable: readonly SegmentType[] = format.types;\n const types = format.parts\n .map((part) => part.type)\n .filter((type): type is EditableSegmentType =>\n type === \"era\" ? count > 1 : editable.includes(type),\n );\n return {\n ...format,\n types,\n eras: types.includes(\"era\")\n ? Array.from({ length: count }, (_, era) =>\n system.eraName(format.locale, era),\n )\n : undefined,\n };\n}\n\n/** The range of the era, the month (13 in a Hebrew leap year) and the day; none for the time. */\nexport function segmentCalendarRange(\n format: SegmentFormat,\n values: SegmentValues,\n type: EditableSegmentType,\n): SegmentRange | undefined {\n const system = systemOf(format);\n switch (type) {\n case \"era\":\n return { min: 0, max: (format.eras?.length ?? 1) - 1, digits: 0 };\n case \"month\":\n return {\n min: 1,\n max: system.monthsInYear(sampleYear(format, values)),\n digits: 2,\n };\n case \"day\": {\n if (values.month === undefined) {\n return { min: 1, max: 31, digits: 2 };\n }\n const year = sampleYear(format, values);\n return {\n min: 1,\n max: system.daysInMonth(\n year,\n Math.min(values.month, system.monthsInYear(year)),\n ),\n digits: 2,\n };\n }\n default:\n return undefined;\n }\n}\n\n/**\n * The values, completed where they are placeholders, as the UTC date `Intl` formats: the longest\n * year (a day set with no year keeps the longest month), an era set with no year its second year\n * (wholly in it).\n */\nexport function segmentCalendarSample(\n format: SegmentFormat,\n values: SegmentValues,\n): Date {\n const system = systemOf(format);\n const date = utcMidnight(\n system.fromFields({\n year:\n calendarYear(format, values) ??\n (values.era === undefined\n ? system.referenceYear()\n : system.yearOfEra(values.era, 2)),\n month: values.month ?? 1,\n day: values.day ?? 1,\n }),\n );\n date.setUTCHours(\n values.hour ?? (values.dayPeriod === 1 ? 12 : 0),\n values.minute ?? 0,\n values.second ?? 0,\n );\n return date;\n}\n\n/** A value with its ISO date as the system's fields (the era's year where the era is edited). */\nexport function segmentCalendarFields(\n format: SegmentFormat,\n value: Partial<PlainDateTime>,\n): Partial<PlainDateTime> & { era?: number } {\n if (\n value.year === undefined ||\n value.month === undefined ||\n value.day === undefined\n ) {\n return value;\n }\n const fields = systemOf(format).fields(value as PlainDate);\n return {\n ...value,\n era: fields.era,\n year: format.eras ? fields.eraYear : fields.year,\n month: fields.month,\n day: fields.day,\n };\n}\n\n/** The ISO date of the values' fields; `null` while a date segment is a placeholder. */\nexport function segmentCalendarDate(\n format: SegmentFormat,\n values: SegmentValues,\n): PlainDate | null {\n const year = calendarYear(format, values);\n const { month, day } = values;\n return year === undefined || month === undefined || day === undefined\n ? null\n : systemOf(format).fromFields({ year, month, day });\n}\n","import type { CalendarKeyOptions } from \"../date/calendar-keys.ts\";\nimport type { PlainDate } from \"../date/plain-date.ts\";\nimport { type CalendarUnits, monthUnits, yearUnits } from \"./calendar-units.ts\";\nimport {\n addDays,\n fromEpochDay,\n startOfWeek,\n toEpochDay,\n utcMidnight,\n} from \"./epoch-day.ts\";\nimport {\n segmentCalendarDate,\n segmentCalendarFields,\n segmentCalendarFormat,\n segmentCalendarRange,\n segmentCalendarSample,\n} from \"./segment-hooks.ts\";\n\n/** The calendar systems of spec/calendar-systems.md, by their `Intl` (CLDR) identifier. */\nexport type CalendarId =\n | \"gregory\"\n | \"buddhist\"\n | \"japanese\"\n | \"roc\"\n | \"persian\"\n | \"indian\"\n | \"islamic-civil\"\n | \"islamic-tbla\"\n | \"islamic-umalqura\"\n | \"hebrew\"\n | \"coptic\"\n | \"ethiopic\"\n | \"ethioaa\";\n\n/**\n * An ISO date's fields in a calendar system (spec/calendar-systems.md, \"Fields\"). `year` is the\n * system's arithmetic year (it keeps counting across eras: Temporal's `year`); `era` is an index\n * into the system's eras (oldest first) and `eraYear` the year within it, as `Intl` writes it;\n * `month` is the month's place in its year (1–13: a Hebrew leap year's Adar I is 6).\n */\nexport interface CalendarDateFields {\n readonly era: number;\n readonly eraYear: number;\n readonly year: number;\n readonly month: number;\n readonly day: number;\n}\n\n/** A month of a calendar system: its arithmetic year and its place in the year. */\nexport interface CalendarYearMonth {\n readonly year: number;\n readonly month: number;\n}\n\n/**\n * The fields a date is built from: the arithmetic `year`, or an `era` and its `eraYear`; a month\n * or day past its year's or month's end is clamped into it (Temporal's `constrain`).\n */\nexport interface CalendarFieldsInput {\n readonly year?: number;\n readonly era?: number;\n readonly eraYear?: number;\n readonly month: number;\n readonly day: number;\n}\n\n/**\n * The math of one system, on days counted from 1970-01-01 (internal: each system's engine is\n * either the ISO calendar shifted, or `Intl` probed).\n */\nexport interface CalendarEngine {\n readonly id: CalendarId;\n /** The fields of a day. */\n fields(epochDay: number): CalendarDateFields;\n /** The first day of a month (`month` 1–`monthsInYear(year)`). */\n monthStart(year: number, month: number): number;\n monthsInYear(year: number): number;\n /** The months of the years before `year` (a month's serial number is this plus its index). */\n monthsBefore(year: number): number;\n /** How many eras the system has (1 for most). */\n readonly eraCount: () => number;\n /** The arithmetic year of an era's year. */\n yearOfEra(era: number, eraYear: number): number;\n /** A day of the era, for its name. */\n eraSample(era: number): number;\n /**\n * The place a leap year inserts its leap month at (the Hebrew Adar I, 6), so a date moved by\n * years keeps its month (Temporal's month code); `0` for none.\n */\n readonly leapMonth: number;\n}\n\n/**\n * A calendar system (spec/calendar-systems.md): the date math and the names of a non-Gregorian\n * calendar over ISO dates. Values stay ISO `PlainDate`s; a component given one shows and moves\n * through its months and years. Each system is its own export of `@fragiola/primitives/calendar-systems`,\n * so an app pays only for the systems it imports, and one that passes none pays nothing.\n */\nexport interface CalendarSystem {\n readonly id: CalendarId;\n /** `locale` with this calendar (`-u-ca-<id>`): `Intl` writes its names. */\n locale(locale: string): string;\n /** The fields of an ISO date. */\n fields(date: PlainDate): CalendarDateFields;\n /** The ISO date of fields (clamped into the month and year). */\n fromFields(fields: CalendarFieldsInput): PlainDate;\n /** How many eras the system has (era segments are editable when more than one). */\n eraCount(): number;\n /** The arithmetic year of an era's year. */\n yearOfEra(era: number, eraYear: number): number;\n /** An era's name from `Intl` (`era: \"short\"`). */\n eraName(locale: string, era: number): string;\n monthsInYear(year: number): number;\n daysInMonth(year: number, month: number): number;\n /**\n * A year whose months are the longest the system has (a leap year), for a month or day\n * typed before its year.\n */\n referenceYear(): number;\n startOfMonth(date: PlainDate): PlainDate;\n endOfMonth(date: PlainDate): PlainDate;\n /** The same day `months` later, clamped to the target month's last day. */\n addMonths(date: PlainDate, months: number): PlainDate;\n /** The same month and day `years` later (a leap month to its common year's month), clamped. */\n addYears(date: PlainDate, years: number): PlainDate;\n /** The difference in whole months from `a`'s month to `b`'s month. */\n monthsBetween(a: PlainDate, b: PlainDate): number;\n isSameMonth(a: PlainDate, b: PlainDate): boolean;\n /** The 6 weeks shown for the month holding `date`, from the locale's first day. */\n monthGrid(date: PlainDate, firstDayOfWeek: number): PlainDate[][];\n /** `calendarKeyTarget` (`/date`) in this system: Page Up and Down move by its months and years. */\n keyTarget(\n key: string,\n focused: PlainDate,\n options: CalendarKeyOptions,\n ): PlainDate | null;\n /** A month as one number (its months counted from the system's year 0): `+ 1` is the next. */\n monthIndex(month: CalendarYearMonth): number;\n fromMonthIndex(index: number): CalendarYearMonth;\n /** The ISO date of a month's first day. */\n monthStart(month: CalendarYearMonth): PlainDate;\n /** The month of an ISO date. */\n yearMonthOf(date: PlainDate): CalendarYearMonth;\n /**\n * A day cell's name: the weekday, day, month and year in this system. Its fields are explicit\n * (not `dateStyle: \"full\"`): Chromium's ICU has no Hebrew-calendar `he` date styles and writes\n * `57870310 12:00 AM` for them (spec/calendar-systems.md, \"Recorded limits\").\n */\n fullDate(locale: string, date: PlainDate): string;\n /** An ISO date written by `Intl` in this system (`timeZone: \"UTC\"`: no host zone moves it). */\n format(\n locale: string,\n date: PlainDate,\n options: Intl.DateTimeFormatOptions,\n ): string;\n /**\n * `Intl.DateTimeFormat#formatRange` of two ISO dates in this system, every space written as\n * U+0020 (engines differ on the spaces around the dash: the `/month-year` year span's rule).\n */\n formatRange(\n locale: string,\n start: PlainDate,\n end: PlainDate,\n options: Intl.DateTimeFormatOptions,\n ): string;\n /** The items of a month or year calendar in this system (cached per kind). */\n units(kind: \"month\" | \"year\"): CalendarUnits;\n // The segments' hooks (`/segments` calls them through a format's `calendar`, which is this\n // system): the era, the system's months and its fields live here, so a field given no\n // calendar bundles none of them.\n /** A field's format in this system: the era editable where it has several, their names. */\n segmentFormat: typeof segmentCalendarFormat;\n /** The range of the era, month and day segments (`undefined` for the others). */\n segmentRange: typeof segmentCalendarRange;\n /** Segment values as the UTC date `Intl` formats, completed where they are placeholders. */\n segmentSample: typeof segmentCalendarSample;\n /** A value's date as this system's fields (`segmentValuesOf`). */\n segmentValuesOf: typeof segmentCalendarFields;\n /** The ISO date of segment values (`segmentsToDate`); `null` while one is a placeholder. */\n segmentsToDate: typeof segmentCalendarDate;\n}\n\n/** The longest-months year near the system's year of 2000-01-01, searched over a 19-year cycle. */\nfunction longestYear(engine: CalendarEngine): number {\n const base = engine.fields(\n toEpochDay({ year: 2000, month: 1, day: 1 }),\n ).year;\n let best = base;\n let bestDays = -1;\n for (let year = base; year < base + 19; year++) {\n const days =\n engine.monthStart(year + 1, 1) - engine.monthStart(year, 1);\n if (days > bestDays) {\n best = year;\n bestDays = days;\n }\n }\n return best;\n}\n\n/** The system's object over an engine: the generic math every component calls. */\nexport function createCalendarSystem(engine: CalendarEngine): CalendarSystem {\n const { id } = engine;\n let reference: number | undefined;\n const units: Partial<Record<\"month\" | \"year\", CalendarUnits>> = {};\n const monthsInYear = (year: number) => engine.monthsInYear(year);\n const daysInMonth = (year: number, month: number) => {\n const next =\n month >= monthsInYear(year)\n ? engine.monthStart(year + 1, 1)\n : engine.monthStart(year, month + 1);\n return next - engine.monthStart(year, month);\n };\n const fields = (date: PlainDate) => engine.fields(toEpochDay(date));\n const fromFields = (input: CalendarFieldsInput): PlainDate => {\n const year =\n input.era !== undefined && input.eraYear !== undefined\n ? engine.yearOfEra(input.era, input.eraYear)\n : (input.year ?? 1);\n const month = Math.min(Math.max(1, input.month), monthsInYear(year));\n const day = Math.min(Math.max(1, input.day), daysInMonth(year, month));\n return fromEpochDay(engine.monthStart(year, month) + day - 1);\n };\n const monthIndex = (month: CalendarYearMonth) =>\n engine.monthsBefore(month.year) + month.month - 1;\n const fromMonthIndex = (index: number): CalendarYearMonth => {\n // a first guess from 12 months a year, then the year whose months hold the index\n let year = Math.floor(index / 12);\n while (engine.monthsBefore(year) > index) {\n year--;\n }\n while (engine.monthsBefore(year + 1) <= index) {\n year++;\n }\n return { year, month: index - engine.monthsBefore(year) + 1 };\n };\n const yearMonthOf = (date: PlainDate): CalendarYearMonth => {\n const { year, month } = fields(date);\n return { year, month };\n };\n const addMonths = (date: PlainDate, months: number): PlainDate => {\n const { day } = fields(date);\n const target = fromMonthIndex(monthIndex(yearMonthOf(date)) + months);\n return fromFields({ ...target, day });\n };\n const addYears = (date: PlainDate, years: number): PlainDate => {\n const { year, month, day } = fields(date);\n const leap = engine.leapMonth;\n let target = month;\n if (leap > 0) {\n // the month's code (Temporal's): a leap year's leap month is `leap - 0.5` (Adar I,\n // M05L), the months after it shift back by one\n const code =\n monthsInYear(year) > 12 && month >= leap\n ? month === leap\n ? leap - 0.5\n : month - 1\n : month;\n // in a common year the leap month becomes the month after it (Adar), as Temporal's\n // `constrain` does\n target =\n monthsInYear(year + years) > 12\n ? code === leap - 0.5\n ? leap\n : code >= leap\n ? code + 1\n : code\n : Math.ceil(code);\n }\n return fromFields({ year: year + years, month: target, day });\n };\n const formatter = (locale: string, options: Intl.DateTimeFormatOptions) =>\n new Intl.DateTimeFormat(system.locale(locale), {\n ...options,\n timeZone: \"UTC\",\n });\n const startOfMonth = (date: PlainDate) =>\n fromFields({ ...yearMonthOf(date), day: 1 });\n const system: CalendarSystem = {\n id,\n locale: (locale) =>\n new Intl.Locale(locale, { calendar: id }).toString(),\n fields,\n fromFields,\n eraCount: () => engine.eraCount(),\n yearOfEra: (era, eraYear) => engine.yearOfEra(era, eraYear),\n eraName: (locale, era) =>\n formatter(locale, { era: \"short\", year: \"numeric\" })\n .formatToParts(utcMidnight(fromEpochDay(engine.eraSample(era))))\n .find((part) => part.type === \"era\")?.value ?? \"\",\n monthsInYear,\n daysInMonth,\n referenceYear: () => {\n reference ??= longestYear(engine);\n return reference;\n },\n startOfMonth,\n endOfMonth: (date) => {\n const month = yearMonthOf(date);\n return fromFields({\n ...month,\n day: daysInMonth(month.year, month.month),\n });\n },\n addMonths,\n addYears,\n monthsBetween: (a, b) =>\n monthIndex(yearMonthOf(b)) - monthIndex(yearMonthOf(a)),\n isSameMonth: (a, b) =>\n monthIndex(yearMonthOf(a)) === monthIndex(yearMonthOf(b)),\n monthGrid: (date, firstDayOfWeek) => {\n let cursor = startOfWeek(startOfMonth(date), firstDayOfWeek);\n return Array.from({ length: 6 }, () =>\n Array.from({ length: 7 }, () => {\n const day = cursor;\n cursor = addDays(cursor, 1);\n return day;\n }),\n );\n },\n keyTarget: (key, focused, { rtl, firstDayOfWeek, shiftKey }) => {\n switch (key) {\n case \"ArrowRight\":\n return addDays(focused, rtl ? -1 : 1);\n case \"ArrowLeft\":\n return addDays(focused, rtl ? 1 : -1);\n case \"ArrowDown\":\n return addDays(focused, 7);\n case \"ArrowUp\":\n return addDays(focused, -7);\n case \"Home\":\n return startOfWeek(focused, firstDayOfWeek);\n case \"End\":\n return addDays(startOfWeek(focused, firstDayOfWeek), 6);\n case \"PageDown\":\n return shiftKey\n ? addYears(focused, 1)\n : addMonths(focused, 1);\n case \"PageUp\":\n return shiftKey\n ? addYears(focused, -1)\n : addMonths(focused, -1);\n default:\n return null;\n }\n },\n monthIndex,\n fromMonthIndex,\n monthStart: (month) => fromFields({ ...month, day: 1 }),\n yearMonthOf,\n fullDate: (locale, date) =>\n formatter(locale, {\n weekday: \"long\",\n year: \"numeric\",\n month: \"long\",\n day: \"numeric\",\n }).format(utcMidnight(date)),\n format: (locale, date, options) =>\n formatter(locale, options).format(utcMidnight(date)),\n formatRange: (locale, start, end, options) =>\n formatter(locale, options)\n .formatRange(utcMidnight(start), utcMidnight(end))\n .replace(/[\\u00a0\\u2009\\u202f]/g, \" \"),\n units: (kind) => {\n units[kind] ??=\n kind === \"month\" ? monthUnits(system) : yearUnits(system);\n return units[kind];\n },\n segmentFormat: segmentCalendarFormat,\n segmentRange: segmentCalendarRange,\n segmentSample: segmentCalendarSample,\n segmentValuesOf: segmentCalendarFields,\n segmentsToDate: segmentCalendarDate,\n };\n return system;\n}\n","import type {\n CalendarDateFields,\n CalendarEngine,\n CalendarId,\n} from \"./calendar-system.ts\";\nimport { fromEpochDay, toEpochDay, utcMidnight } from \"./epoch-day.ts\";\n\ninterface Probe {\n readonly era: string;\n readonly eraYear: number;\n readonly day: number;\n}\n\n/**\n * A system computed by `Intl` (spec/calendar-systems.md, \"How a system is computed\"): ICU does the\n * math, this probes it. A day's year and day of the month come from `formatToParts` in the\n * system (`en`, Latin digits); a month starts on its day 1, a year on its first month; the month\n * starts of each year are found once and cached, so a month's place counts from its year's first\n * month (the Hebrew calendar writes its months by name). `monthsBefore` is the system's rule:\n * 12 months a year, 13 (Coptic, Ethiopic), or the Hebrew 19-year cycle.\n */\nexport function intlEngine(\n id: CalendarId,\n months: 12 | 13 | \"hebrew\",\n leapMonth = 0,\n): CalendarEngine {\n let format: Intl.DateTimeFormat | undefined;\n const probes = new Map<number, Probe>();\n const starts = new Map<number, number[]>();\n let mainEra: string | undefined;\n let meanYear = 0;\n const reference = toEpochDay({ year: 2000, month: 1, day: 1 });\n\n const probe = (day: number): Probe => {\n let found = probes.get(day);\n if (found === undefined) {\n format ??= new Intl.DateTimeFormat(`en-u-ca-${id}-nu-latn`, {\n era: \"short\",\n year: \"numeric\",\n month: \"numeric\",\n day: \"numeric\",\n timeZone: \"UTC\",\n });\n const parts = format.formatToParts(utcMidnight(fromEpochDay(day)));\n const value = (type: string) =>\n parts.find((part) => part.type === type)?.value ?? \"\";\n found = {\n era: value(\"era\"),\n eraYear: Number(value(\"year\")),\n day: Number(value(\"day\")),\n };\n probes.set(day, found);\n }\n return found;\n };\n const yearOf = (day: number): number => {\n const { era, eraYear } = probe(day);\n mainEra ??= probe(reference).era;\n if (era === mainEra) {\n return eraYear;\n }\n // before the system's era: Ethiopic counts the Amete Alem (5500 years earlier), the others\n // count down from 1\n return id === \"ethiopic\" ? eraYear - 5500 : 1 - eraYear;\n };\n const monthStartOf = (day: number) => day - probe(day).day + 1;\n const yearStart = (year: number): number => {\n if (meanYear === 0) {\n meanYear =\n 36_524 / (yearOf(reference + 36_524) - yearOf(reference));\n }\n let day = reference + Math.round((year - yearOf(reference)) * meanYear);\n while (yearOf(day) < year) {\n day += 20;\n }\n while (yearOf(day) > year) {\n day -= 20;\n }\n let start = monthStartOf(day);\n while (yearOf(start - 1) === year) {\n start = monthStartOf(start - 1);\n }\n return start;\n };\n const monthStarts = (year: number): number[] => {\n let list = starts.get(year);\n if (list === undefined) {\n list = [];\n // a month is never longer than 32 days, and a month and the next are longer together\n // (the 5-day Coptic and Ethiopic 13th month follows a 30-day one)\n for (\n let start = yearStart(year);\n yearOf(start) === year;\n start = monthStartOf(start + 32)\n ) {\n list.push(start);\n }\n starts.set(year, list);\n }\n return list;\n };\n const monthsBefore = (year: number): number =>\n months === \"hebrew\"\n ? Math.floor((235 * year - 234) / 19)\n : months * year;\n return {\n id,\n leapMonth,\n fields: (day): CalendarDateFields => {\n const year = yearOf(day);\n const list = monthStarts(year);\n let month = 1;\n while (month < list.length && (list[month] as number) <= day) {\n month++;\n }\n return {\n era: 0,\n eraYear: year,\n year,\n month,\n day: day - (list[month - 1] as number) + 1,\n };\n },\n monthStart: (year, month) => {\n const list = monthStarts(year);\n return list[\n Math.min(Math.max(1, month), list.length) - 1\n ] as number;\n },\n monthsInYear: (year) => monthStarts(year).length,\n monthsBefore,\n eraCount: () => 1,\n yearOfEra: (_era, eraYear) => eraYear,\n eraSample: () => reference,\n };\n}\n","import type {\n CalendarDateFields,\n CalendarEngine,\n CalendarId,\n} from \"./calendar-system.ts\";\nimport { fromEpochDay, toEpochDay } from \"./epoch-day.ts\";\n\n/**\n * The eras of an ISO-based system: each era's first day (days from 1970-01-01) and its first\n * arithmetic year, oldest first.\n */\nexport interface IsoEra {\n readonly start: number;\n readonly year: number;\n}\n\n/**\n * A system with the ISO calendar's months and days (gregory, buddhist, roc, japanese): its year is\n * the ISO year shifted by `offset`, and `eras` splits it (spec/calendar-systems.md, \"Systems\").\n * With `before` (gregory, roc), the years before the first era count down in an era of their own\n * (1 BC is the year 0).\n */\nexport function isoEngine(\n id: CalendarId,\n offset: number,\n eras: () => readonly IsoEra[],\n before: boolean,\n): CalendarEngine {\n const all = () =>\n before\n ? [{ start: Number.NEGATIVE_INFINITY, year: 0 }, ...eras()]\n : eras();\n return {\n id,\n leapMonth: 0,\n fields: (epochDay): CalendarDateFields => {\n const iso = fromEpochDay(epochDay);\n const year = iso.year + offset;\n const list = all();\n let era = 0;\n for (let index = 1; index < list.length; index++) {\n if ((list[index] as IsoEra).start <= epochDay) {\n era = index;\n }\n }\n const first = (list[era] as IsoEra).year;\n return {\n era,\n // the era before the first counts down: its last year is 1\n eraYear: before && era === 0 ? 1 - year : year - first + 1,\n year,\n month: iso.month,\n day: iso.day,\n };\n },\n monthStart: (year, month) =>\n toEpochDay({ year: year - offset, month, day: 1 }),\n monthsInYear: () => 12,\n monthsBefore: (year) => year * 12,\n eraCount: () => all().length,\n yearOfEra: (era, eraYear) => {\n const list = all();\n const index = Math.min(Math.max(0, era), list.length - 1);\n return before && index === 0\n ? 1 - eraYear\n : (list[index] as IsoEra).year + eraYear - 1;\n },\n eraSample: (era) => {\n const list = all();\n const index = Math.min(Math.max(0, era), list.length - 1);\n if (before && index === 0) {\n return toEpochDay({ year: -offset, month: 6, day: 1 });\n }\n const { start } = list[index] as IsoEra;\n // a single era with no start (buddhist): any day names it\n return Number.isFinite(start)\n ? start\n : toEpochDay({ year: 2000, month: 1, day: 1 });\n },\n };\n}\n","import { fromEpochDay, toEpochDay, utcMidnight } from \"./epoch-day.ts\";\nimport type { IsoEra } from \"./iso-engine.ts\";\n\n/** The first ISO year whose eras the japanese system computes: Meiji (spec/calendar-systems.md). */\nconst FIRST_YEAR = 1868;\n/** The last ISO year scanned for an era change. */\nconst LAST_YEAR = 2200;\n\nlet cache: readonly IsoEra[] | undefined;\n\n/**\n * The Japanese eras from Meiji on, with their first days, read from `Intl` (`era` of the\n * `japanese` calendar): each year's last day is compared with the previous year's, and a change\n * is searched day by day by halves. Computed once, on first use.\n */\nexport function japaneseEras(): readonly IsoEra[] {\n if (cache !== undefined) {\n return cache;\n }\n const format = new Intl.DateTimeFormat(\"en-u-ca-japanese\", {\n era: \"short\",\n timeZone: \"UTC\",\n });\n const eraOf = (day: number) =>\n format\n .formatToParts(utcMidnight(fromEpochDay(day)))\n .find((part) => part.type === \"era\")?.value ?? \"\";\n const eras: IsoEra[] = [];\n let previous = toEpochDay({ year: FIRST_YEAR - 1, month: 12, day: 31 });\n let previousEra = eraOf(previous);\n for (let year = FIRST_YEAR; year <= LAST_YEAR; year++) {\n const last = toEpochDay({ year, month: 12, day: 31 });\n const era = eraOf(last);\n if (era !== previousEra) {\n // the first day of `era` in (previous, last]\n let low = previous;\n let high = last;\n while (high - low > 1) {\n const middle = Math.floor((low + high) / 2);\n if (eraOf(middle) === era) {\n high = middle;\n } else {\n low = middle;\n }\n }\n eras.push({ start: high, year: fromEpochDay(high).year });\n previousEra = era;\n }\n previous = last;\n }\n cache = eras;\n return eras;\n}\n","import { createCalendarSystem } from \"./calendar-system.ts\";\nimport { toEpochDay } from \"./epoch-day.ts\";\nimport { intlEngine } from \"./intl-engine.ts\";\nimport { isoEngine } from \"./iso-engine.ts\";\nimport { japaneseEras } from \"./japanese-eras.ts\";\n\n// One export per system (spec/calendar-systems.md, \"Systems\"), each a pure call: an app bundles\n// only the systems it imports.\n\nconst AD = () => [\n { start: toEpochDay({ year: 1, month: 1, day: 1 }), year: 1 },\n];\n\n/** The Gregorian calendar (`gregory`): eras BC and AD. */\nexport const gregory = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ isoEngine(\"gregory\", 0, AD, true),\n);\n\n/** The Thai Buddhist calendar (`buddhist`): the ISO year + 543, era BE. */\nexport const buddhist = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ isoEngine(\n \"buddhist\",\n 543,\n () => [{ start: Number.NEGATIVE_INFINITY, year: 1 }],\n false,\n ),\n);\n\n/** The Republic of China calendar (`roc`): the ISO year − 1911, eras before R.O.C. and Minguo. */\nexport const roc = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ isoEngine(\n \"roc\",\n -1911,\n () => [\n { start: toEpochDay({ year: 1912, month: 1, day: 1 }), year: 1 },\n ],\n true,\n ),\n);\n\n/** The Japanese imperial calendar (`japanese`): the ISO year in eras from Meiji on. */\nexport const japanese = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ isoEngine(\"japanese\", 0, japaneseEras, false),\n);\n\n/** The Persian (Solar Hijri) calendar (`persian`). */\nexport const persian = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ intlEngine(\"persian\", 12),\n);\n\n/** The Indian national (Saka) calendar (`indian`). */\nexport const indian = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ intlEngine(\"indian\", 12),\n);\n\n/** The tabular Islamic calendar, civil epoch (`islamic-civil`). */\nexport const islamicCivil = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ intlEngine(\"islamic-civil\", 12),\n);\n\n/** The tabular Islamic calendar, astronomical epoch (`islamic-tbla`). */\nexport const islamicTbla = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ intlEngine(\"islamic-tbla\", 12),\n);\n\n/** The Islamic Umm al-Qura calendar of Saudi Arabia (`islamic-umalqura`). */\nexport const islamicUmalqura = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ intlEngine(\"islamic-umalqura\", 12),\n);\n\n/** The Hebrew calendar (`hebrew`): 12 or 13 months, Adar I the leap month (6). */\nexport const hebrew = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ intlEngine(\"hebrew\", \"hebrew\", 6),\n);\n\n/** The Coptic calendar (`coptic`): 13 months. */\nexport const coptic = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ intlEngine(\"coptic\", 13),\n);\n\n/** The Ethiopic calendar, Amete Mihret (`ethiopic`): 13 months. */\nexport const ethiopic = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ intlEngine(\"ethiopic\", 13),\n);\n\n/** The Ethiopic calendar, Amete Alem (`ethioaa`): 13 months. */\nexport const ethioaa = /* @__PURE__ */ createCalendarSystem(\n /* @__PURE__ */ intlEngine(\"ethioaa\", 13),\n);\n"],"mappings":";AAEA,MAAM,MAAM;;AAGZ,SAAgB,YAAY,MAAuB;CAC/C,MAAM,sBAAM,IAAI,KAAK,CAAC;CACtB,IAAI,eAAe,KAAK,MAAM,KAAK,QAAQ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EACA,WAAW;CACf;CACA,QAAQ;CACR,OAAO;AACX;;AC3CA,MAAM,WAAW,CACb;CAAE,OAAO,WAAW;EAAE,MAAM;EAAG,OAAO;EAAG,KAAK;CAAE,CAAC;CAAG,MAAM;AAAE,CAChE;;AAGA,MAAa,UAA0B,qCACnB,0BAAU,WAAW,GAAG,IAAI,IAAI,CACpD;;AAGA,MAAa,WAA2B,qCACpB,0BACZ,YACA,WACM,CAAC;CAAE,OAAO,OAAO;CAAmB,MAAM;AAAE,CAAC,GACnD,KACJ,CACJ;;AAGA,MAAa,MAAsB,qCACf,0BACZ,OACA,aACM,CACF;CAAE,OAAO,WAAW;EAAE,MAAM;EAAM,OAAO;EAAG,KAAK;CAAE,CAAC;CAAG,MAAM;AAAE,CACnE,GACA,IACJ,CACJ;;AAGA,MAAa,WAA2B,qCACpB,0BAAU,YAAY,GAAG,cAAc,KAAK,CAChE;;AAGA,MAAa,UAA0B,qCACnB,2BAAW,WAAW,EAAE,CAC5C;;AAGA,MAAa,SAAyB,qCAClB,2BAAW,UAAU,EAAE,CAC3C;;AAGA,MAAa,eAA+B,qCACxB,2BAAW,iBAAiB,EAAE,CAClD;;AAGA,MAAa,cAA8B,qCACvB,2BAAW,gBAAgB,EAAE,CACjD;;AAGA,MAAa,kBAAkC,qCAC3B,2BAAW,oBAAoB,EAAE,CACrD;;AAGA,MAAa,SAAyB,qCAClB,2BAAW,UAAU,UAAU,CAAC,CACpD;;AAGA,MAAa,SAAyB,qCAClB,2BAAW,UAAU,EAAE,CAC3C;;AAGA,MAAa,WAA2B,qCACpB,2BAAW,YAAY,EAAE,CAC7C;;AAGA,MAAa,UAA0B,qCACnB,2BAAW,WAAW,EAAE,CAC5C"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { K as CalendarUnit, a as CalendarYearMonth, i as CalendarSystem, n as CalendarFieldsInput, q as CalendarUnits, r as CalendarId, t as CalendarDateFields } from "./calendar-system-B5U5HcPQ.js";
|
|
2
|
+
import { a as gregory, c as islamicCivil, d as japanese, f as persian, i as ethiopic, l as islamicTbla, n as coptic, o as hebrew, p as roc, r as ethioaa, s as indian, t as buddhist, u as islamicUmalqura } from "./index-IfDZj87U.js";
|
|
3
|
+
export { type CalendarDateFields, type CalendarFieldsInput, type CalendarId, type CalendarSystem, type CalendarUnit, type CalendarUnits, type CalendarYearMonth, buddhist, coptic, ethioaa, ethiopic, gregory, hebrew, indian, islamicCivil, islamicTbla, islamicUmalqura, japanese, persian, roc };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as buddhist, n as coptic, r as ethioaa, i as ethiopic, a as gregory, o as hebrew, s as indian, c as islamicCivil, l as islamicTbla, u as islamicUmalqura, d as japanese, f as persian, p as roc } from "./calendar-systems-Daa6Q_ca.js";
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
import { t as getDirection } from "./direction-DJDPvnxJ.js";
|
|
2
|
+
import { t as getTabbables } from "./tabbable-BPiLssIv.js";
|
|
3
|
+
import { t as startDrag } from "./drag-session-CSr06B5v.js";
|
|
4
|
+
import "./watch-swipe-BIucfr9O.js";
|
|
5
|
+
// src/carousel/carousel-pages.ts
|
|
6
|
+
/** A positive whole number, else the fallback. */
|
|
7
|
+
function whole(value, fallback) {
|
|
8
|
+
return value === void 0 || !Number.isFinite(value) || value < 1 ? fallback : Math.floor(value);
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The first slide of every page, in order (spec/carousel.md, "The pages"): slide 0, then every
|
|
12
|
+
* `slidesPerMove` slides while a page still shows `slidesPerPage` slides, and the last page at
|
|
13
|
+
* `slideCount - slidesPerPage`, so every page is full (a snapped scroll ends there). Pure math;
|
|
14
|
+
* always at least one page.
|
|
15
|
+
*/
|
|
16
|
+
function carouselPages({ slideCount, slidesPerPage, slidesPerMove }) {
|
|
17
|
+
const count = Math.max(0, Math.floor(slideCount));
|
|
18
|
+
const perPage = whole(slidesPerPage, 1);
|
|
19
|
+
const perMove = whole(slidesPerMove, perPage);
|
|
20
|
+
const last = Math.max(0, count - perPage);
|
|
21
|
+
const starts = [];
|
|
22
|
+
for (let start = 0; start < last; start += perMove) starts.push(start);
|
|
23
|
+
starts.push(last);
|
|
24
|
+
return starts;
|
|
25
|
+
}
|
|
26
|
+
/** `page` kept within the pages (`0` to `pageCount - 1`); a fraction is rounded down. */
|
|
27
|
+
function clampCarouselPage(page, pageCount) {
|
|
28
|
+
if (!Number.isFinite(page)) return 0;
|
|
29
|
+
return Math.min(Math.max(0, pageCount - 1), Math.max(0, Math.floor(page)));
|
|
30
|
+
}
|
|
31
|
+
/** The slides a page shows: `slidesPerPage` slides from its first, within the slides. */
|
|
32
|
+
function slidesInView(pages, page, slideCount, slidesPerPage) {
|
|
33
|
+
const start = pages[clampCarouselPage(page, pages.length)] ?? 0;
|
|
34
|
+
const end = Math.min(slideCount, start + whole(slidesPerPage, 1));
|
|
35
|
+
const slides = [];
|
|
36
|
+
for (let index = start; index < end; index++) slides.push(index);
|
|
37
|
+
return slides;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The page a move from `page` reaches (`1` next, `-1` previous), or `null` at an edge; with `loop`
|
|
41
|
+
* the edges wrap.
|
|
42
|
+
*/
|
|
43
|
+
function stepCarouselPage(page, pageCount, step, loop) {
|
|
44
|
+
const next = page + step;
|
|
45
|
+
if (next >= 0 && next < pageCount) return next;
|
|
46
|
+
if (!loop || pageCount < 2) return null;
|
|
47
|
+
return next < 0 ? pageCount - 1 : 0;
|
|
48
|
+
}
|
|
49
|
+
// src/carousel/carousel-scroll.ts
|
|
50
|
+
/**
|
|
51
|
+
* Where `group` must be scrolled for `slide` to sit at its start (spec/carousel.md, "Pointer"):
|
|
52
|
+
* the `scrollLeft` (or `scrollTop`) that aligns the slide's inline-start edge (its top) with the
|
|
53
|
+
* group's, less the group's padding there. In RTL the start is the right edge and Chromium's
|
|
54
|
+
* `scrollLeft` runs from `0` to negative values, so the same subtraction holds.
|
|
55
|
+
*/
|
|
56
|
+
function slideScrollPosition(group, slide, orientation, direction) {
|
|
57
|
+
const groupBox = group.getBoundingClientRect();
|
|
58
|
+
const slideBox = slide.getBoundingClientRect();
|
|
59
|
+
const style = group.ownerDocument.defaultView?.getComputedStyle(group);
|
|
60
|
+
const padding = (value) => Number.parseFloat(value ?? "") || 0;
|
|
61
|
+
if (orientation === "vertical") return group.scrollTop + slideBox.top - groupBox.top - group.clientTop - padding(style?.paddingTop);
|
|
62
|
+
if (getDirection(group, direction) === "rtl") {
|
|
63
|
+
const borderRight = groupBox.width - group.clientLeft - group.clientWidth;
|
|
64
|
+
const start = groupBox.right - borderRight - padding(style?.paddingRight);
|
|
65
|
+
return group.scrollLeft + slideBox.right - start;
|
|
66
|
+
}
|
|
67
|
+
return group.scrollLeft + slideBox.left - groupBox.left - group.clientLeft - padding(style?.paddingLeft);
|
|
68
|
+
}
|
|
69
|
+
/** The group's scroll position on its axis. */
|
|
70
|
+
function groupScrollPosition(group, orientation) {
|
|
71
|
+
return orientation === "vertical" ? group.scrollTop : group.scrollLeft;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The page whose first slide is nearest the group's scroll position (`pages` holds each page's
|
|
75
|
+
* first slide; `slide(index)` gives a slide's element): the page a scroll settled on.
|
|
76
|
+
*/
|
|
77
|
+
function nearestCarouselPage(group, pages, slide, orientation, direction) {
|
|
78
|
+
const position = groupScrollPosition(group, orientation);
|
|
79
|
+
let best = 0;
|
|
80
|
+
let distance = Number.POSITIVE_INFINITY;
|
|
81
|
+
pages.forEach((start, page) => {
|
|
82
|
+
const element = slide(start);
|
|
83
|
+
if (element === null) return;
|
|
84
|
+
const away = Math.abs(slideScrollPosition(group, element, orientation, direction) - position);
|
|
85
|
+
if (away < distance) {
|
|
86
|
+
distance = away;
|
|
87
|
+
best = page;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
return best;
|
|
91
|
+
}
|
|
92
|
+
// src/carousel/rotation-timer.ts
|
|
93
|
+
/**
|
|
94
|
+
* The delay of a carousel's rotation (spec/carousel.md, "The rotation"), on `element`'s window
|
|
95
|
+
* timers: it decides nothing, the framework starts it on every page while playing, and pauses it
|
|
96
|
+
* while a hover pauses the rotation, which resumes with the time it had left (Toast's pause rule).
|
|
97
|
+
*/
|
|
98
|
+
function createRotationTimer(element) {
|
|
99
|
+
const view = element.ownerDocument.defaultView;
|
|
100
|
+
let handle;
|
|
101
|
+
let callback = null;
|
|
102
|
+
let remaining = 0;
|
|
103
|
+
let startedAt = 0;
|
|
104
|
+
let paused = false;
|
|
105
|
+
const now = () => view?.performance.now() ?? 0;
|
|
106
|
+
const clear = () => {
|
|
107
|
+
if (handle !== void 0) {
|
|
108
|
+
view?.clearTimeout(handle);
|
|
109
|
+
handle = void 0;
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const run = () => {
|
|
113
|
+
clear();
|
|
114
|
+
const elapse = callback;
|
|
115
|
+
if (view === null || elapse === null) return;
|
|
116
|
+
startedAt = now();
|
|
117
|
+
handle = view.setTimeout(() => {
|
|
118
|
+
handle = void 0;
|
|
119
|
+
callback = null;
|
|
120
|
+
elapse();
|
|
121
|
+
}, remaining);
|
|
122
|
+
};
|
|
123
|
+
return {
|
|
124
|
+
start(delay, onElapse) {
|
|
125
|
+
callback = onElapse;
|
|
126
|
+
remaining = Math.max(0, delay);
|
|
127
|
+
if (paused) clear();
|
|
128
|
+
else run();
|
|
129
|
+
},
|
|
130
|
+
pause() {
|
|
131
|
+
if (paused) return;
|
|
132
|
+
paused = true;
|
|
133
|
+
if (handle !== void 0) {
|
|
134
|
+
remaining = Math.max(0, remaining - (now() - startedAt));
|
|
135
|
+
clear();
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
resume() {
|
|
139
|
+
if (!paused) return;
|
|
140
|
+
paused = false;
|
|
141
|
+
run();
|
|
142
|
+
},
|
|
143
|
+
stop() {
|
|
144
|
+
clear();
|
|
145
|
+
callback = null;
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
// src/carousel/watch-carousel.ts
|
|
150
|
+
/** How long after the last `scroll` a scroll counts as settled without `scrollend`, in ms. */
|
|
151
|
+
const SETTLE_DELAY = 100;
|
|
152
|
+
/** A press on one of these is no drag (`/swipe`'s rule for a mouse). */
|
|
153
|
+
const INTERACTIVE = "a[href],button,input,select,textarea,label,summary,[role=\"button\"],[contenteditable]:not([contenteditable=\"false\"])";
|
|
154
|
+
/** The input that starts a scroll of the user's own, which replaces a scroll of ours. */
|
|
155
|
+
const USER_INPUT = [
|
|
156
|
+
"pointerdown",
|
|
157
|
+
"wheel",
|
|
158
|
+
"touchstart",
|
|
159
|
+
"keydown"
|
|
160
|
+
];
|
|
161
|
+
/**
|
|
162
|
+
* The DOM side of a carousel (spec/carousel.md): native listeners on its `root` and its slides'
|
|
163
|
+
* scroll container `group`, so a framework's own event system (Vue's invoker under a fixed test
|
|
164
|
+
* clock) never drops one. It scrolls the group to a page, reports the page a user's scroll settled
|
|
165
|
+
* on, runs the mouse drag (`/pointer`'s drag session, snapping off while it runs), and reports
|
|
166
|
+
* the hover and the focus entering. It holds no page and no playing state: the framework does.
|
|
167
|
+
*/
|
|
168
|
+
function watchCarousel(root, group, options) {
|
|
169
|
+
const view = root.ownerDocument.defaultView;
|
|
170
|
+
let settleTimer;
|
|
171
|
+
/**
|
|
172
|
+
* Where a scroll of our own goes: its settling reports nothing, nor does a scroll that stops
|
|
173
|
+
* on the way (a later scroll of our own replaced it); the user's input clears it.
|
|
174
|
+
*/
|
|
175
|
+
let programmatic = null;
|
|
176
|
+
/** The snap type a drag turned off, put back once the scroll after it settled. */
|
|
177
|
+
let heldSnap = null;
|
|
178
|
+
let dragging = false;
|
|
179
|
+
let dragFrom = 0;
|
|
180
|
+
let hovered = false;
|
|
181
|
+
const position = () => groupScrollPosition(group, options.orientation());
|
|
182
|
+
const pagePosition = (page) => {
|
|
183
|
+
const start = options.pages()[page];
|
|
184
|
+
const element = start === void 0 ? null : options.slide(start);
|
|
185
|
+
return element === null ? null : slideScrollPosition(group, element, options.orientation(), options.direction());
|
|
186
|
+
};
|
|
187
|
+
const reducedMotion = () => view?.matchMedia?.("(prefers-reduced-motion: reduce)").matches === true;
|
|
188
|
+
const scrollTo = (target, instant) => {
|
|
189
|
+
programmatic = target;
|
|
190
|
+
const vertical = options.orientation() === "vertical";
|
|
191
|
+
group.scrollTo({
|
|
192
|
+
[vertical ? "top" : "left"]: target,
|
|
193
|
+
behavior: instant || reducedMotion() ? "instant" : "smooth"
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
const scrollToPage = (page, instant = false) => {
|
|
197
|
+
const target = pagePosition(page);
|
|
198
|
+
if (target === null || Math.abs(target - position()) < 1) return;
|
|
199
|
+
scrollTo(target, instant);
|
|
200
|
+
};
|
|
201
|
+
const restoreSnap = () => {
|
|
202
|
+
if (heldSnap !== null) {
|
|
203
|
+
group.style.scrollSnapType = heldSnap;
|
|
204
|
+
heldSnap = null;
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const settle = (event) => {
|
|
208
|
+
if (settleTimer !== void 0) {
|
|
209
|
+
view?.clearTimeout(settleTimer);
|
|
210
|
+
settleTimer = void 0;
|
|
211
|
+
}
|
|
212
|
+
if (dragging) return;
|
|
213
|
+
if (programmatic !== null) {
|
|
214
|
+
if (Math.abs(programmatic - position()) < 1) {
|
|
215
|
+
programmatic = null;
|
|
216
|
+
restoreSnap();
|
|
217
|
+
}
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
restoreSnap();
|
|
221
|
+
options.onPageSettle(nearestCarouselPage(group, options.pages(), options.slide, options.orientation(), options.direction()), "swipe", event);
|
|
222
|
+
};
|
|
223
|
+
const onScroll = () => {
|
|
224
|
+
if (settleTimer !== void 0) view?.clearTimeout(settleTimer);
|
|
225
|
+
settleTimer = view?.setTimeout(() => settle(void 0), SETTLE_DELAY);
|
|
226
|
+
};
|
|
227
|
+
const onScrollEnd = (event) => settle(event);
|
|
228
|
+
const onUserInput = () => {
|
|
229
|
+
programmatic = null;
|
|
230
|
+
};
|
|
231
|
+
const onPointerOver = (event) => {
|
|
232
|
+
const target = event.target;
|
|
233
|
+
const next = !(target instanceof Element && options.hoverExempt?.(target));
|
|
234
|
+
if (next !== hovered) {
|
|
235
|
+
hovered = next;
|
|
236
|
+
options.onHoverChange(next);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
const onPointerLeave = () => {
|
|
240
|
+
if (hovered) {
|
|
241
|
+
hovered = false;
|
|
242
|
+
options.onHoverChange(false);
|
|
243
|
+
}
|
|
244
|
+
};
|
|
245
|
+
let pressing = false;
|
|
246
|
+
let pressTimer;
|
|
247
|
+
const onPressEnd = () => {
|
|
248
|
+
view?.removeEventListener("pointerup", onPressEnd, true);
|
|
249
|
+
view?.removeEventListener("pointercancel", onPressEnd, true);
|
|
250
|
+
pressTimer = view?.setTimeout(() => {
|
|
251
|
+
pressing = false;
|
|
252
|
+
}, 0);
|
|
253
|
+
};
|
|
254
|
+
const onPressStart = () => {
|
|
255
|
+
if (pressTimer !== void 0) view?.clearTimeout(pressTimer);
|
|
256
|
+
pressing = true;
|
|
257
|
+
view?.addEventListener("pointerup", onPressEnd, true);
|
|
258
|
+
view?.addEventListener("pointercancel", onPressEnd, true);
|
|
259
|
+
};
|
|
260
|
+
const onFocusIn = (event) => {
|
|
261
|
+
const from = event.relatedTarget;
|
|
262
|
+
if (from instanceof Node && root.contains(from)) return;
|
|
263
|
+
const target = event.target;
|
|
264
|
+
if (pressing && target instanceof Element && options.hoverExempt?.(target)) return;
|
|
265
|
+
options.onFocusIn(event);
|
|
266
|
+
};
|
|
267
|
+
const swallowClick = (event) => {
|
|
268
|
+
event.preventDefault();
|
|
269
|
+
event.stopPropagation();
|
|
270
|
+
};
|
|
271
|
+
/** The page a drag released on: the nearest, or after a flick the next one its way. */
|
|
272
|
+
const releasedPage = (velocity) => {
|
|
273
|
+
const pages = options.pages();
|
|
274
|
+
const vertical = options.orientation() === "vertical";
|
|
275
|
+
const page = nearestCarouselPage(group, pages, options.slide, options.orientation(), options.direction());
|
|
276
|
+
const from = options.page();
|
|
277
|
+
if (Math.abs(velocity) <= .5 || page !== from) return page;
|
|
278
|
+
const step = Math.sign(position() - dragFrom);
|
|
279
|
+
const forward = !vertical && getDirection(group, options.direction()) === "rtl" ? -step : step;
|
|
280
|
+
return Math.min(pages.length - 1, Math.max(0, from + forward));
|
|
281
|
+
};
|
|
282
|
+
let stopDrag = null;
|
|
283
|
+
let destroyed = false;
|
|
284
|
+
const onPointerDown = (event) => {
|
|
285
|
+
const target = event.target;
|
|
286
|
+
if (stopDrag !== null || event.pointerType !== "mouse" || event.button !== 0 || !event.isPrimary || !options.allowMouseDrag() || !(target instanceof Element) || target.closest(INTERACTIVE) !== null) return;
|
|
287
|
+
event.preventDefault();
|
|
288
|
+
const vertical = options.orientation() === "vertical";
|
|
289
|
+
const origin = vertical ? event.clientY : event.clientX;
|
|
290
|
+
let started = false;
|
|
291
|
+
let last = {
|
|
292
|
+
time: event.timeStamp,
|
|
293
|
+
at: origin
|
|
294
|
+
};
|
|
295
|
+
let velocity = 0;
|
|
296
|
+
dragFrom = position();
|
|
297
|
+
stopDrag = startDrag(group, event, {
|
|
298
|
+
onMove: (move) => {
|
|
299
|
+
const at = vertical ? move.clientY : move.clientX;
|
|
300
|
+
const delta = at - origin;
|
|
301
|
+
if (!started) {
|
|
302
|
+
if (Math.abs(delta) < 6) return;
|
|
303
|
+
started = true;
|
|
304
|
+
dragging = true;
|
|
305
|
+
if (heldSnap === null) heldSnap = group.style.scrollSnapType;
|
|
306
|
+
group.style.scrollSnapType = "none";
|
|
307
|
+
options.onDraggingChange(true);
|
|
308
|
+
}
|
|
309
|
+
const elapsed = move.timeStamp - last.time;
|
|
310
|
+
if (elapsed > 0) velocity = (at - last.at) / elapsed;
|
|
311
|
+
last = {
|
|
312
|
+
time: move.timeStamp,
|
|
313
|
+
at
|
|
314
|
+
};
|
|
315
|
+
if (vertical) group.scrollTop = dragFrom - delta;
|
|
316
|
+
else group.scrollLeft = dragFrom - delta;
|
|
317
|
+
},
|
|
318
|
+
onEnd: (up) => {
|
|
319
|
+
stopDrag = null;
|
|
320
|
+
if (!started) return;
|
|
321
|
+
if (destroyed) {
|
|
322
|
+
dragging = false;
|
|
323
|
+
restoreSnap();
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
dragging = false;
|
|
327
|
+
options.onDraggingChange(false);
|
|
328
|
+
group.addEventListener("click", swallowClick, true);
|
|
329
|
+
view?.setTimeout(() => group.removeEventListener("click", swallowClick, true), 0);
|
|
330
|
+
const rest = up === null || up.timeStamp - last.time > 80;
|
|
331
|
+
const page = releasedPage(rest ? 0 : velocity);
|
|
332
|
+
if (settleTimer !== void 0) {
|
|
333
|
+
view?.clearTimeout(settleTimer);
|
|
334
|
+
settleTimer = void 0;
|
|
335
|
+
}
|
|
336
|
+
const target = pagePosition(page);
|
|
337
|
+
if (target === null || Math.abs(target - position()) < 1) restoreSnap();
|
|
338
|
+
else scrollTo(target, false);
|
|
339
|
+
options.onPageSettle(page, "drag", up ?? void 0);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
group.addEventListener("scroll", onScroll);
|
|
344
|
+
group.addEventListener("scrollend", onScrollEnd);
|
|
345
|
+
for (const type of USER_INPUT) group.addEventListener(type, onUserInput, { passive: true });
|
|
346
|
+
group.addEventListener("pointerdown", onPointerDown);
|
|
347
|
+
root.addEventListener("pointerdown", onPressStart);
|
|
348
|
+
root.addEventListener("pointerover", onPointerOver);
|
|
349
|
+
root.addEventListener("pointerleave", onPointerLeave);
|
|
350
|
+
root.addEventListener("focusin", onFocusIn);
|
|
351
|
+
return {
|
|
352
|
+
needsTabStop: () => getTabbables(group).length === 0,
|
|
353
|
+
scrollToPage,
|
|
354
|
+
destroy: () => {
|
|
355
|
+
destroyed = true;
|
|
356
|
+
stopDrag?.();
|
|
357
|
+
if (pressTimer !== void 0) view?.clearTimeout(pressTimer);
|
|
358
|
+
group.removeEventListener("pointerdown", onPointerDown);
|
|
359
|
+
root.removeEventListener("pointerdown", onPressStart);
|
|
360
|
+
view?.removeEventListener("pointerup", onPressEnd, true);
|
|
361
|
+
view?.removeEventListener("pointercancel", onPressEnd, true);
|
|
362
|
+
if (settleTimer !== void 0) view?.clearTimeout(settleTimer);
|
|
363
|
+
group.removeEventListener("scroll", onScroll);
|
|
364
|
+
group.removeEventListener("scrollend", onScrollEnd);
|
|
365
|
+
for (const type of USER_INPUT) group.removeEventListener(type, onUserInput);
|
|
366
|
+
group.removeEventListener("click", swallowClick, true);
|
|
367
|
+
root.removeEventListener("pointerover", onPointerOver);
|
|
368
|
+
root.removeEventListener("pointerleave", onPointerLeave);
|
|
369
|
+
root.removeEventListener("focusin", onFocusIn);
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
export { slideScrollPosition as a, slidesInView as c, nearestCarouselPage as i, stepCarouselPage as l, createRotationTimer as n, carouselPages as o, groupScrollPosition as r, clampCarouselPage as s, watchCarousel as t };
|
|
374
|
+
|
|
375
|
+
//# sourceMappingURL=carousel-LRbWqbAx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"carousel-LRbWqbAx.js","names":[],"sources":["../src/carousel/carousel-pages.ts","../src/carousel/carousel-scroll.ts","../src/carousel/rotation-timer.ts","../src/carousel/watch-carousel.ts"],"sourcesContent":["export interface CarouselPagesOptions {\n /** The number of slides. */\n slideCount: number;\n /** The slides a page shows side by side (default `1`). */\n slidesPerPage?: number | undefined;\n /** The slides a page moves by (default `slidesPerPage`). */\n slidesPerMove?: number | undefined;\n}\n\n/** A positive whole number, else the fallback. */\nfunction whole(value: number | undefined, fallback: number): number {\n return value === undefined || !Number.isFinite(value) || value < 1\n ? fallback\n : Math.floor(value);\n}\n\n/**\n * The first slide of every page, in order (spec/carousel.md, \"The pages\"): slide 0, then every\n * `slidesPerMove` slides while a page still shows `slidesPerPage` slides, and the last page at\n * `slideCount - slidesPerPage`, so every page is full (a snapped scroll ends there). Pure math;\n * always at least one page.\n */\nexport function carouselPages({\n slideCount,\n slidesPerPage,\n slidesPerMove,\n}: CarouselPagesOptions): number[] {\n const count = Math.max(0, Math.floor(slideCount));\n const perPage = whole(slidesPerPage, 1);\n const perMove = whole(slidesPerMove, perPage);\n const last = Math.max(0, count - perPage);\n const starts: number[] = [];\n for (let start = 0; start < last; start += perMove) {\n starts.push(start);\n }\n starts.push(last);\n return starts;\n}\n\n/** `page` kept within the pages (`0` to `pageCount - 1`); a fraction is rounded down. */\nexport function clampCarouselPage(page: number, pageCount: number): number {\n if (!Number.isFinite(page)) {\n return 0;\n }\n return Math.min(Math.max(0, pageCount - 1), Math.max(0, Math.floor(page)));\n}\n\n/** The slides a page shows: `slidesPerPage` slides from its first, within the slides. */\nexport function slidesInView(\n pages: readonly number[],\n page: number,\n slideCount: number,\n slidesPerPage: number | undefined,\n): number[] {\n const start = pages[clampCarouselPage(page, pages.length)] ?? 0;\n const end = Math.min(slideCount, start + whole(slidesPerPage, 1));\n const slides: number[] = [];\n for (let index = start; index < end; index++) {\n slides.push(index);\n }\n return slides;\n}\n\n/**\n * The page a move from `page` reaches (`1` next, `-1` previous), or `null` at an edge; with `loop`\n * the edges wrap.\n */\nexport function stepCarouselPage(\n page: number,\n pageCount: number,\n step: 1 | -1,\n loop: boolean,\n): number | null {\n const next = page + step;\n if (next >= 0 && next < pageCount) {\n return next;\n }\n if (!loop || pageCount < 2) {\n return null;\n }\n return next < 0 ? pageCount - 1 : 0;\n}\n","import { type Direction, getDirection } from \"../direction/direction.ts\";\n\nexport type CarouselOrientation = \"horizontal\" | \"vertical\";\n\n/**\n * Where `group` must be scrolled for `slide` to sit at its start (spec/carousel.md, \"Pointer\"):\n * the `scrollLeft` (or `scrollTop`) that aligns the slide's inline-start edge (its top) with the\n * group's, less the group's padding there. In RTL the start is the right edge and Chromium's\n * `scrollLeft` runs from `0` to negative values, so the same subtraction holds.\n */\nexport function slideScrollPosition(\n group: HTMLElement,\n slide: HTMLElement,\n orientation: CarouselOrientation,\n direction?: Direction | null,\n): number {\n const groupBox = group.getBoundingClientRect();\n const slideBox = slide.getBoundingClientRect();\n const style = group.ownerDocument.defaultView?.getComputedStyle(group);\n const padding = (value: string | undefined) =>\n Number.parseFloat(value ?? \"\") || 0;\n if (orientation === \"vertical\") {\n return (\n group.scrollTop +\n slideBox.top -\n groupBox.top -\n group.clientTop -\n padding(style?.paddingTop)\n );\n }\n if (getDirection(group, direction) === \"rtl\") {\n // the inner right edge: the group's box less its right border\n const borderRight =\n groupBox.width - group.clientLeft - group.clientWidth;\n const start =\n groupBox.right - borderRight - padding(style?.paddingRight);\n return group.scrollLeft + slideBox.right - start;\n }\n return (\n group.scrollLeft +\n slideBox.left -\n groupBox.left -\n group.clientLeft -\n padding(style?.paddingLeft)\n );\n}\n\n/** The group's scroll position on its axis. */\nexport function groupScrollPosition(\n group: HTMLElement,\n orientation: CarouselOrientation,\n): number {\n return orientation === \"vertical\" ? group.scrollTop : group.scrollLeft;\n}\n\n/**\n * The page whose first slide is nearest the group's scroll position (`pages` holds each page's\n * first slide; `slide(index)` gives a slide's element): the page a scroll settled on.\n */\nexport function nearestCarouselPage(\n group: HTMLElement,\n pages: readonly number[],\n slide: (index: number) => HTMLElement | null,\n orientation: CarouselOrientation,\n direction?: Direction | null,\n): number {\n const position = groupScrollPosition(group, orientation);\n let best = 0;\n let distance = Number.POSITIVE_INFINITY;\n pages.forEach((start, page) => {\n const element = slide(start);\n if (element === null) {\n return;\n }\n const away = Math.abs(\n slideScrollPosition(group, element, orientation, direction) -\n position,\n );\n if (away < distance) {\n distance = away;\n best = page;\n }\n });\n return best;\n}\n","export interface RotationTimer {\n /** Starts the delay again from its whole length; `onElapse` runs once it passed. */\n start: (delay: number, onElapse: () => void) => void;\n /** Holds the running delay, keeping the time it has left. */\n pause: () => void;\n /** Runs a held delay on for the time it had left. */\n resume: () => void;\n /** Clears the delay. */\n stop: () => void;\n}\n\n/**\n * The delay of a carousel's rotation (spec/carousel.md, \"The rotation\"), on `element`'s window\n * timers: it decides nothing, the framework starts it on every page while playing, and pauses it\n * while a hover pauses the rotation, which resumes with the time it had left (Toast's pause rule).\n */\nexport function createRotationTimer(element: Element): RotationTimer {\n const view = element.ownerDocument.defaultView;\n let handle: number | undefined;\n let callback: (() => void) | null = null;\n let remaining = 0;\n let startedAt = 0;\n let paused = false;\n const now = () => view?.performance.now() ?? 0;\n const clear = () => {\n if (handle !== undefined) {\n view?.clearTimeout(handle);\n handle = undefined;\n }\n };\n const run = () => {\n clear();\n const elapse = callback;\n if (view === null || elapse === null) {\n return;\n }\n startedAt = now();\n handle = view.setTimeout(() => {\n handle = undefined;\n callback = null;\n elapse();\n }, remaining);\n };\n return {\n start(delay, onElapse) {\n callback = onElapse;\n remaining = Math.max(0, delay);\n if (paused) {\n clear();\n } else {\n run();\n }\n },\n pause() {\n if (paused) {\n return;\n }\n paused = true;\n if (handle !== undefined) {\n remaining = Math.max(0, remaining - (now() - startedAt));\n clear();\n }\n },\n resume() {\n if (!paused) {\n return;\n }\n paused = false;\n run();\n },\n stop() {\n clear();\n callback = null;\n },\n };\n}\n","import { type Direction, getDirection } from \"../direction/direction.ts\";\nimport { getTabbables } from \"../focus/tabbable.ts\";\nimport { startDrag } from \"../pointer/drag-session.ts\";\nimport { SWIPE_FLICK_VELOCITY } from \"../swipe/swipe-release.ts\";\nimport { SWIPE_LOCK_DISTANCE } from \"../swipe/watch-swipe.ts\";\nimport {\n type CarouselOrientation,\n groupScrollPosition,\n nearestCarouselPage,\n slideScrollPosition,\n} from \"./carousel-scroll.ts\";\n\n/** How long after the last `scroll` a scroll counts as settled without `scrollend`, in ms. */\nconst SETTLE_DELAY = 100;\n\n/** A press on one of these is no drag (`/swipe`'s rule for a mouse). */\nconst INTERACTIVE =\n 'a[href],button,input,select,textarea,label,summary,[role=\"button\"],[contenteditable]:not([contenteditable=\"false\"])';\n\n/** The input that starts a scroll of the user's own, which replaces a scroll of ours. */\nconst USER_INPUT = [\"pointerdown\", \"wheel\", \"touchstart\", \"keydown\"] as const;\n\nexport interface CarouselWatchOptions {\n orientation: () => CarouselOrientation;\n /** The direction a DirectionProvider gives, `null` without one. */\n direction: () => Direction | null;\n /** Whether a mouse drag scrolls the slides. */\n allowMouseDrag: () => boolean;\n /** Each page's first slide, in order (`carouselPages`). */\n pages: () => readonly number[];\n /** The current page, which a drag moves from. */\n page: () => number;\n /** A slide's element, by its index. */\n slide: (index: number) => HTMLElement | null;\n /**\n * The AutoplayTrigger: the pointer over it does not pause the rotation, and a pointer press\n * focusing it does not stop it (the press toggles it).\n */\n hoverExempt?: (target: Element) => boolean;\n /** The pointer started or stopped hovering the carousel (but an exempt element). */\n onHoverChange: (hovered: boolean) => void;\n /** Focus entered the carousel from outside it. */\n onFocusIn: (event: FocusEvent) => void;\n /** A mouse drag started or ended. */\n onDraggingChange: (dragging: boolean) => void;\n /**\n * A scroll the user made settled on `page`: `swipe` for any native scroll (touch, a trackpad,\n * the wheel), `drag` for a mouse drag. The group already scrolls to it.\n */\n onPageSettle: (\n page: number,\n reason: \"swipe\" | \"drag\",\n event: Event | undefined,\n ) => void;\n}\n\nexport interface CarouselController {\n /**\n * Whether the group needs a tab stop of its own: it holds no element Tab reaches (the\n * out-of-view slides are `inert`), so a keyboard can still scroll it (ScrollArea's rule).\n */\n needsTabStop: () => boolean;\n /** Scrolls the group to a page's first slide: smoothly, or at once (`instant`). */\n scrollToPage: (page: number, instant?: boolean) => void;\n destroy: () => void;\n}\n\n/**\n * The DOM side of a carousel (spec/carousel.md): native listeners on its `root` and its slides'\n * scroll container `group`, so a framework's own event system (Vue's invoker under a fixed test\n * clock) never drops one. It scrolls the group to a page, reports the page a user's scroll settled\n * on, runs the mouse drag (`/pointer`'s drag session, snapping off while it runs), and reports\n * the hover and the focus entering. It holds no page and no playing state: the framework does.\n */\nexport function watchCarousel(\n root: HTMLElement,\n group: HTMLElement,\n options: CarouselWatchOptions,\n): CarouselController {\n const view = root.ownerDocument.defaultView;\n let settleTimer: number | undefined;\n /**\n * Where a scroll of our own goes: its settling reports nothing, nor does a scroll that stops\n * on the way (a later scroll of our own replaced it); the user's input clears it.\n */\n let programmatic: number | null = null;\n /** The snap type a drag turned off, put back once the scroll after it settled. */\n let heldSnap: string | null = null;\n let dragging = false;\n let dragFrom = 0;\n let hovered = false;\n\n const position = () => groupScrollPosition(group, options.orientation());\n const pagePosition = (page: number) => {\n const start = options.pages()[page];\n const element = start === undefined ? null : options.slide(start);\n return element === null\n ? null\n : slideScrollPosition(\n group,\n element,\n options.orientation(),\n options.direction(),\n );\n };\n const reducedMotion = () =>\n view?.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches === true;\n\n const scrollTo = (target: number, instant: boolean) => {\n programmatic = target;\n const vertical = options.orientation() === \"vertical\";\n group.scrollTo({\n [vertical ? \"top\" : \"left\"]: target,\n behavior: instant || reducedMotion() ? \"instant\" : \"smooth\",\n });\n };\n\n const scrollToPage = (page: number, instant = false) => {\n const target = pagePosition(page);\n if (target === null || Math.abs(target - position()) < 1) {\n return;\n }\n scrollTo(target, instant);\n };\n\n const restoreSnap = () => {\n if (heldSnap !== null) {\n group.style.scrollSnapType = heldSnap;\n heldSnap = null;\n }\n };\n\n const settle = (event: Event | undefined) => {\n if (settleTimer !== undefined) {\n view?.clearTimeout(settleTimer);\n settleTimer = undefined;\n }\n if (dragging) {\n return;\n }\n if (programmatic !== null) {\n if (Math.abs(programmatic - position()) < 1) {\n programmatic = null;\n restoreSnap();\n }\n return;\n }\n restoreSnap();\n options.onPageSettle(\n nearestCarouselPage(\n group,\n options.pages(),\n options.slide,\n options.orientation(),\n options.direction(),\n ),\n \"swipe\",\n event,\n );\n };\n\n const onScroll = () => {\n if (settleTimer !== undefined) {\n view?.clearTimeout(settleTimer);\n }\n settleTimer = view?.setTimeout(() => settle(undefined), SETTLE_DELAY);\n };\n const onScrollEnd = (event: Event) => settle(event);\n const onUserInput = () => {\n programmatic = null;\n };\n\n const onPointerOver = (event: PointerEvent) => {\n const target = event.target;\n const next = !(\n target instanceof Element && options.hoverExempt?.(target)\n );\n if (next !== hovered) {\n hovered = next;\n options.onHoverChange(next);\n }\n };\n const onPointerLeave = () => {\n if (hovered) {\n hovered = false;\n options.onHoverChange(false);\n }\n };\n // a pointer press on the AutoplayTrigger focuses it without stopping the rotation: the\n // press itself toggles it. The press ends a task after the pointer's release, since a touch\n // focuses with its compatibility `mousedown`, which follows `pointerup`\n let pressing = false;\n let pressTimer: number | undefined;\n const onPressEnd = () => {\n view?.removeEventListener(\"pointerup\", onPressEnd, true);\n view?.removeEventListener(\"pointercancel\", onPressEnd, true);\n pressTimer = view?.setTimeout(() => {\n pressing = false;\n }, 0);\n };\n const onPressStart = () => {\n if (pressTimer !== undefined) {\n view?.clearTimeout(pressTimer);\n }\n pressing = true;\n view?.addEventListener(\"pointerup\", onPressEnd, true);\n view?.addEventListener(\"pointercancel\", onPressEnd, true);\n };\n const onFocusIn = (event: FocusEvent) => {\n const from = event.relatedTarget;\n if (from instanceof Node && root.contains(from)) {\n return;\n }\n const target = event.target;\n if (\n pressing &&\n target instanceof Element &&\n options.hoverExempt?.(target)\n ) {\n return;\n }\n options.onFocusIn(event);\n };\n\n // the click that ends a drag is not delivered (a slide's link would follow it)\n const swallowClick = (event: MouseEvent) => {\n event.preventDefault();\n event.stopPropagation();\n };\n\n /** The page a drag released on: the nearest, or after a flick the next one its way. */\n const releasedPage = (velocity: number) => {\n const pages = options.pages();\n const vertical = options.orientation() === \"vertical\";\n const page = nearestCarouselPage(\n group,\n pages,\n options.slide,\n options.orientation(),\n options.direction(),\n );\n const from = options.page();\n if (Math.abs(velocity) <= SWIPE_FLICK_VELOCITY || page !== from) {\n return page;\n }\n // a flick moves one page the way the content travelled: towards the scroll's end is the\n // next page (in RTL the horizontal scroll runs to negative values)\n const step = Math.sign(position() - dragFrom);\n const rtl =\n !vertical && getDirection(group, options.direction()) === \"rtl\";\n const forward = rtl ? -step : step;\n return Math.min(pages.length - 1, Math.max(0, from + forward));\n };\n\n // the mouse drag: `/pointer`'s drag session (with capture), started once the pointer moved\n // the swipe's lock distance along the axis. `/swipe`'s `watchSwipe` hands a move over a\n // scroller to that scroller (its scroll containment), and the group is that scroller\n let stopDrag: (() => void) | null = null;\n let destroyed = false;\n const onPointerDown = (event: PointerEvent) => {\n const target = event.target;\n if (\n stopDrag !== null ||\n event.pointerType !== \"mouse\" ||\n event.button !== 0 ||\n !event.isPrimary ||\n !options.allowMouseDrag() ||\n !(target instanceof Element) ||\n target.closest(INTERACTIVE) !== null\n ) {\n return;\n }\n // no text selection and no focus from the press: the slides are dragged\n event.preventDefault();\n const vertical = options.orientation() === \"vertical\";\n const origin = vertical ? event.clientY : event.clientX;\n let started = false;\n let last = { time: event.timeStamp, at: origin };\n let velocity = 0;\n dragFrom = position();\n stopDrag = startDrag(group, event, {\n onMove: (move) => {\n const at = vertical ? move.clientY : move.clientX;\n const delta = at - origin;\n if (!started) {\n if (Math.abs(delta) < SWIPE_LOCK_DISTANCE) {\n return;\n }\n started = true;\n dragging = true;\n if (heldSnap === null) {\n heldSnap = group.style.scrollSnapType;\n }\n group.style.scrollSnapType = \"none\";\n options.onDraggingChange(true);\n }\n const elapsed = move.timeStamp - last.time;\n if (elapsed > 0) {\n velocity = (at - last.at) / elapsed;\n }\n last = { time: move.timeStamp, at };\n if (vertical) {\n group.scrollTop = dragFrom - delta;\n } else {\n group.scrollLeft = dragFrom - delta;\n }\n },\n onEnd: (up) => {\n stopDrag = null;\n if (!started) {\n return;\n }\n if (destroyed) {\n // the watch ends (an unmount, another axis): no page to report\n dragging = false;\n restoreSnap();\n return;\n }\n dragging = false;\n options.onDraggingChange(false);\n group.addEventListener(\"click\", swallowClick, true);\n view?.setTimeout(\n () =>\n group.removeEventListener(\"click\", swallowClick, true),\n 0,\n );\n // a release at rest is no flick\n const rest = up === null || up.timeStamp - last.time > 80;\n const page = releasedPage(rest ? 0 : velocity);\n if (settleTimer !== undefined) {\n view?.clearTimeout(settleTimer);\n settleTimer = undefined;\n }\n const target = pagePosition(page);\n if (target === null || Math.abs(target - position()) < 1) {\n restoreSnap();\n } else {\n scrollTo(target, false);\n }\n options.onPageSettle(page, \"drag\", up ?? undefined);\n },\n });\n };\n\n group.addEventListener(\"scroll\", onScroll);\n group.addEventListener(\"scrollend\", onScrollEnd);\n for (const type of USER_INPUT) {\n group.addEventListener(type, onUserInput, { passive: true });\n }\n group.addEventListener(\"pointerdown\", onPointerDown);\n root.addEventListener(\"pointerdown\", onPressStart);\n root.addEventListener(\"pointerover\", onPointerOver);\n root.addEventListener(\"pointerleave\", onPointerLeave);\n root.addEventListener(\"focusin\", onFocusIn);\n\n return {\n needsTabStop: () => getTabbables(group).length === 0,\n scrollToPage,\n destroy: () => {\n destroyed = true;\n stopDrag?.();\n if (pressTimer !== undefined) {\n view?.clearTimeout(pressTimer);\n }\n group.removeEventListener(\"pointerdown\", onPointerDown);\n root.removeEventListener(\"pointerdown\", onPressStart);\n view?.removeEventListener(\"pointerup\", onPressEnd, true);\n view?.removeEventListener(\"pointercancel\", onPressEnd, true);\n if (settleTimer !== undefined) {\n view?.clearTimeout(settleTimer);\n }\n group.removeEventListener(\"scroll\", onScroll);\n group.removeEventListener(\"scrollend\", onScrollEnd);\n for (const type of USER_INPUT) {\n group.removeEventListener(type, onUserInput);\n }\n group.removeEventListener(\"click\", swallowClick, true);\n root.removeEventListener(\"pointerover\", onPointerOver);\n root.removeEventListener(\"pointerleave\", onPointerLeave);\n root.removeEventListener(\"focusin\", onFocusIn);\n },\n };\n}\n"],"mappings":";;;;;;AAUA,SAAS,MAAM,OAA2B,UAA0B;CAChE,OAAO,UAAU,KAAA,KAAa,CAAC,OAAO,SAAS,KAAK,KAAK,QAAQ,IAC3D,WACA,KAAK,MAAM,KAAK;AAC1B;;;;;;;AAQA,SAAgB,cAAc,EAC1B,YACA,eACA,iBAC+B;CAC/B,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,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Y;SAEZ,SAAS,QAAQ,KAAK;IAE1B,QAAQ,aAAa,MAAM,QAAQ,MAAM,KAAA,CAAS;GACtD;EACJ,CAAC;CACL;CAEA,MAAM,iBAAiB,UAAU,QAAQ;CACzC,MAAM,iBAAiB,aAAa,WAAW;CAC/C,KAAK,MAAM,QAAQ,YACf,MAAM,iBAAiB,MAAM,aAAa,EAAE,SAAS,KAAK,CAAC;CAE/D,MAAM,iBAAiB,eAAe,aAAa;CACnD,KAAK,iBAAiB,eAAe,YAAY;CACjD,KAAK,iBAAiB,eAAe,aAAa;CAClD,KAAK,iBAAiB,gBAAgB,cAAc;CACpD,KAAK,iBAAiB,WAAW,SAAS;CAE1C,OAAO;EACH,oBAAoB,aAAa,KAAK,CAAC,CAAC,WAAW;EACnD;EACA,eAAe;GACX,YAAY;GACZ,WAAW;GACX,IAAI,eAAe,KAAA,GACf,MAAM,aAAa,UAAU;GAEjC,MAAM,oBAAoB,eAAe,aAAa;GACtD,KAAK,oBAAoB,eAAe,YAAY;GACpD,MAAM,oBAAoB,aAAa,YAAY,IAAI;GACvD,MAAM,oBAAoB,iBAAiB,YAAY,IAAI;GAC3D,IAAI,gBAAgB,KAAA,GAChB,MAAM,aAAa,WAAW;GAElC,MAAM,oBAAoB,UAAU,QAAQ;GAC5C,MAAM,oBAAoB,aAAa,WAAW;GAClD,KAAK,MAAM,QAAQ,YACf,MAAM,oBAAoB,MAAM,WAAW;GAE/C,MAAM,oBAAoB,SAAS,cAAc,IAAI;GACrD,KAAK,oBAAoB,eAAe,aAAa;GACrD,KAAK,oBAAoB,gBAAgB,cAAc;GACvD,KAAK,oBAAoB,WAAW,SAAS;EACjD;CACJ;AACJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { a as createRotationTimer, c as nearestCarouselPage, d as carouselPages, f as clampCarouselPage, i as RotationTimer, l as slideScrollPosition, m as stepCarouselPage, n as CarouselWatchOptions, o as CarouselOrientation, p as slidesInView, r as watchCarousel, s as groupScrollPosition, t as CarouselController, u as CarouselPagesOptions } from "./index-D146vm21.js";
|
|
2
|
+
export { type CarouselController, type CarouselOrientation, type CarouselPagesOptions, type CarouselWatchOptions, type RotationTimer, carouselPages, clampCarouselPage, createRotationTimer, groupScrollPosition, nearestCarouselPage, slideScrollPosition, slidesInView, stepCarouselPage, watchCarousel };
|
package/dist/carousel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { o as carouselPages, s as clampCarouselPage, n as createRotationTimer, r as groupScrollPosition, i as nearestCarouselPage, a as slideScrollPosition, c as slidesInView, l as stepCarouselPage, t as watchCarousel } from "./carousel-LRbWqbAx.js";
|