@fieldia/calendar 0.0.0-stage → 0.23.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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +125 -2
  3. package/package.json +37 -3
  4. package/src/index.d.mts +3 -0
  5. package/src/index.d.ts +3 -0
  6. package/src/index.js +6 -0
  7. package/src/index.js.map +1 -0
  8. package/src/index.mjs +2 -0
  9. package/src/index.mjs.map +1 -0
  10. package/src/lib/calendar-core.d.mts +83 -0
  11. package/src/lib/calendar-core.d.ts +83 -0
  12. package/src/lib/calendar-core.js +18 -0
  13. package/src/lib/calendar-core.js.map +1 -0
  14. package/src/lib/calendar-core.mjs +13 -0
  15. package/src/lib/calendar-core.mjs.map +1 -0
  16. package/src/lib/calendar-view.d.mts +11 -0
  17. package/src/lib/calendar-view.d.ts +11 -0
  18. package/src/lib/calendar-view.js +829 -0
  19. package/src/lib/calendar-view.js.map +1 -0
  20. package/src/lib/calendar-view.mjs +826 -0
  21. package/src/lib/calendar-view.mjs.map +1 -0
  22. package/src/lib/dates.d.mts +43 -0
  23. package/src/lib/dates.d.ts +43 -0
  24. package/src/lib/dates.js +100 -0
  25. package/src/lib/dates.js.map +1 -0
  26. package/src/lib/dates.mjs +80 -0
  27. package/src/lib/dates.mjs.map +1 -0
  28. package/src/lib/events.d.mts +58 -0
  29. package/src/lib/events.d.ts +58 -0
  30. package/src/lib/events.js +136 -0
  31. package/src/lib/events.js.map +1 -0
  32. package/src/lib/events.mjs +125 -0
  33. package/src/lib/events.mjs.map +1 -0
  34. package/src/lib/gestures.d.mts +11 -0
  35. package/src/lib/gestures.d.ts +11 -0
  36. package/src/lib/gestures.js +215 -0
  37. package/src/lib/gestures.js.map +1 -0
  38. package/src/lib/gestures.mjs +210 -0
  39. package/src/lib/gestures.mjs.map +1 -0
  40. package/src/lib/keys.d.mts +5 -0
  41. package/src/lib/keys.d.ts +5 -0
  42. package/src/lib/keys.js +151 -0
  43. package/src/lib/keys.js.map +1 -0
  44. package/src/lib/keys.mjs +146 -0
  45. package/src/lib/keys.mjs.map +1 -0
  46. package/src/lib/labels.d.mts +65 -0
  47. package/src/lib/labels.d.ts +65 -0
  48. package/src/lib/labels.js +193 -0
  49. package/src/lib/labels.js.map +1 -0
  50. package/src/lib/labels.mjs +188 -0
  51. package/src/lib/labels.mjs.map +1 -0
  52. package/src/lib/list-view.d.mts +11 -0
  53. package/src/lib/list-view.d.ts +11 -0
  54. package/src/lib/list-view.js +54 -0
  55. package/src/lib/list-view.js.map +1 -0
  56. package/src/lib/list-view.mjs +51 -0
  57. package/src/lib/list-view.mjs.map +1 -0
  58. package/src/lib/move-to.d.mts +15 -0
  59. package/src/lib/move-to.d.ts +15 -0
  60. package/src/lib/move-to.js +122 -0
  61. package/src/lib/move-to.js.map +1 -0
  62. package/src/lib/move-to.mjs +118 -0
  63. package/src/lib/move-to.mjs.map +1 -0
  64. package/src/lib/settings.d.mts +11 -0
  65. package/src/lib/settings.d.ts +11 -0
  66. package/src/lib/settings.js +3 -0
  67. package/src/lib/settings.js.map +1 -0
  68. package/src/lib/settings.mjs +2 -0
  69. package/src/lib/settings.mjs.map +1 -0
  70. package/src/lib/styles.d.mts +9 -0
  71. package/src/lib/styles.d.ts +9 -0
  72. package/src/lib/styles.js +165 -0
  73. package/src/lib/styles.js.map +1 -0
  74. package/src/lib/styles.mjs +161 -0
  75. package/src/lib/styles.mjs.map +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 fieldia-dev
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,126 @@
1
- # Temporary Holding Version
1
+ # @fieldia/calendar
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [Fieldia](https://fieldia.dev)'s calendar: a **list's records on a calendar**,
4
+ by day, week or month, or as an agenda, with a column for each person or room.
5
+ People drag a record to move it, drag its end to stretch it, press an empty
6
+ slot to make one, and move one from the keyboard with **Move to…**. A move is
7
+ written through the data source's `save`, with **Undo**. It shares the list's
8
+ search, filters and favourites, reads right to left, speaks English, Arabic,
9
+ French and German, and its code loads only when a calendar is first shown.
10
+
11
+ ```sh
12
+ npm install @fieldia/calendar
13
+ ```
14
+
15
+ ```ts
16
+ import { mountViewer } from '@fieldia/viewer';
17
+ import { calendarListViews } from '@fieldia/calendar';
18
+
19
+ mountViewer(host, {
20
+ page,
21
+ dataSource,
22
+ listViews: calendarListViews(),
23
+ // A slot pressed: the app opens a new record with its start and end filled in.
24
+ onNewRecord: (values) => openNewAppointment(values),
25
+ });
26
+ ```
27
+
28
+ With a map as well, register both: `listViews: { ...mapListViews({ provider }), ...calendarListViews() }`.
29
+
30
+ ## The page
31
+
32
+ A list page with `calendar` offers **Calendar** beside its table:
33
+
34
+ ```json
35
+ "layout": {
36
+ "type": "list", "id": "appointments", "columns": ["patient", "start", "doctor"],
37
+ "calendar": {
38
+ "start": "start", "end": "stop", "title": "patient",
39
+ "colour": "service", "resource": "doctor",
40
+ "views": ["day", "week", "month", "agenda"], "view": "day", "opens": "calendar",
41
+ "firstDay": 6, "hours": { "start": 8, "end": 20 }, "slot": 15
42
+ }
43
+ }
44
+ ```
45
+
46
+ | Option | What it does |
47
+ |---|---|
48
+ | `start` | When each record starts: a `date` (it takes the whole day) or a `datetime`. Required. |
49
+ | `end` | When it ends, a field of the same kind. Without it a record lasts an hour (a day, for a date) and cannot be stretched. |
50
+ | `title` | The words on each record. Required. |
51
+ | `colour` | A field whose value colours each record: the same value, the same colour. A value that is a colour itself (`#0f766e`) is used as it is. |
52
+ | `resource` | Who or what each record is with, a link, a choice, text or a whole number: the day view has a column for each, and a record dragged to another column changes it. |
53
+ | `views` | The views offered, in order: `day`, `week`, `month`, `agenda`. All four unless said. |
54
+ | `view` | The view it shows first: the first of `views` unless said. On a phone it opens on the agenda. |
55
+ | `opens` | `calendar` opens the list on its calendar; `list` (unless said) on its table. |
56
+ | `firstDay` | The week's first day, `0` Sunday to `6` Saturday: Saturday in Arabic, Monday in English, French and German unless said. |
57
+ | `hours` | The hours the day and week show, `0` to `24`: 8 to 20 unless said. A record outside them stretches them. |
58
+ | `slot` | The minutes a drag moves by and a slot holds: `15`, `30` (unless said) or `60`. |
59
+
60
+ The page check refuses a field the page lacks or one of the wrong kind, an end
61
+ of another kind than its start, a `view` that is not among `views`, and hours
62
+ that end before they start.
63
+
64
+ ## What a person can do
65
+
66
+ - **See** the week (days across, the hours down), the day (a column for each
67
+ person or room when the page names a `resource`, and one for records with
68
+ no one), the month in whole weeks (with "+2 more" where a day is crowded)
69
+ and the agenda (each day that has something, in order). Records that meet
70
+ sit side by side, as many as the column's width can show the start of a
71
+ name for; past that, "+N more" opens a list of them all. A whole day's
72
+ records sit in the row over the hours. A red line marks now.
73
+ - **Move** a record by dragging it to another time, day or person, and
74
+ **stretch** it by dragging its lower edge. Escape while dragging or
75
+ stretching puts it back, and Escape while dragging across empty slots makes
76
+ nothing. The move is saved at once; **Undo** puts it back.
77
+ - **Make** a record by pressing an empty slot, or dragging down across the
78
+ slots it should take, or with **New**. The app's `onNewRecord` gets the
79
+ values (start, end, person). Without it, the viewer opens the record's page
80
+ from `pages` in a dialog; with neither, nothing offers to make one.
81
+ - **Open** a record by pressing it, or Enter: the app's `onOpenRecord`, as a
82
+ row of the table opens it.
83
+ - **Keys**: the arrow keys move between days and slots (flipped right to
84
+ left), Page Up and Page Down change the week; Enter on an empty slot makes a
85
+ record there; on a record, Enter opens it and M (or Shift+F10) opens
86
+ **Move to…**, a small form for its day, its time and its person. It refuses
87
+ a day more than ten years from the record's own (a year typed as 26 or
88
+ 2062), and the words after a move name the year when it changes. When the
89
+ record leaves the days shown, the keys stand on the step toward its day.
90
+ Each slot and each record says what it is to a screen reader.
91
+
92
+ What cannot be done is hidden, never greyed: with no `save` on the data source,
93
+ or a page whose start, end or person field is `readonly`, nothing moves; a
94
+ record whose list row says `can: { edit: false }`, or puts its start, end or
95
+ person in `can.readonlyFields` or `can.hiddenFields`, stays where it is and
96
+ says why (`can.reason`).
97
+
98
+ ## The data source
99
+
100
+ The calendar asks `list` for the records of the span it shows, with the list's
101
+ own search:
102
+
103
+ ```ts
104
+ filter: [...search, { field: 'start', op: '<', value: spanEnd }, { any: [{ field: 'stop', op: '>', value: spanStart }, { field: 'start', op: '>=', value: spanStart }] }]
105
+ ```
106
+
107
+ A `date` is compared as `"2026-10-14"`, a `datetime` as an ISO instant
108
+ (`toISOString()`), as the date widgets write them. Times are the reader's own;
109
+ time zones of their own come later. A move calls `save` with the changed
110
+ fields alone, in `changes.values` and in `values`, `fields` naming those alone
111
+ and `partial: true` (and the row's `version`, when the list gave one), so a
112
+ source that saves whole records keeps every other field; Undo saves what those
113
+ fields held before, the same way. A refused save puts the record
114
+ back and says why. In the day view, the columns of a link are the related
115
+ records `search` finds (up to 40), with any the records hold besides.
116
+
117
+ ## Settings
118
+
119
+ `calendarListViews({ labels, now, limit })`:
120
+
121
+ - `labels`: words over the calendar's own, by language (`CalendarLabels` names them all).
122
+ - `now`: the moment it is now, for a demo or a test pinned to a day.
123
+ - `limit`: how many records a span asks for at most, 500 unless said. Past
124
+ it, the calendar says how many it leaves out.
125
+
126
+ MIT licensed.
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
2
  "name": "@fieldia/calendar",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.23.0",
4
+ "description": "Fieldia's calendar: a list's records by day, week, month or as an agenda, a column for each person or room, moved by dragging or from the keyboard. Loaded only where a calendar is shown.",
5
+ "license": "MIT",
6
+ "homepage": "https://fieldia.dev",
7
+ "type": "commonjs",
8
+ "main": "./src/index.js",
9
+ "module": "./src/index.mjs",
10
+ "types": "./src/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": {
14
+ "import": "./src/index.d.mts",
15
+ "require": "./src/index.d.ts"
16
+ },
17
+ "import": "./src/index.mjs",
18
+ "require": "./src/index.js",
19
+ "default": "./src/index.js"
20
+ },
21
+ "./package.json": "./package.json"
22
+ },
23
+ "dependencies": {
24
+ "@fieldia/core": "0.23.0",
25
+ "@fieldia/viewer": "0.23.0",
26
+ "@fieldia/widgets": "0.23.0",
27
+ "tslib": "^2.8.1"
28
+ },
29
+ "sideEffects": false,
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/fieldia-dev/fieldia",
33
+ "directory": "libs/calendar"
34
+ },
35
+ "files": [
36
+ "src",
37
+ "README.md",
38
+ "LICENSE"
39
+ ]
6
40
  }
@@ -0,0 +1,3 @@
1
+ export { calendarListViews } from './lib/list-view.mjs';
2
+ export type { CalendarSettings } from './lib/settings.mjs';
3
+ export type { CalendarLabels } from './lib/labels.mjs';
package/src/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { calendarListViews } from './lib/list-view';
2
+ export type { CalendarSettings } from './lib/settings';
3
+ export type { CalendarLabels } from './lib/labels';
package/src/index.js ADDED
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.calendarListViews = void 0;
4
+ var list_view_1 = require("./lib/list-view");
5
+ Object.defineProperty(exports, "calendarListViews", { enumerable: true, get: function () { return list_view_1.calendarListViews; } });
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../libs/calendar/src/index.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AAA3C,8GAAA,iBAAiB,OAAA"}
package/src/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ export { calendarListViews } from './lib/list-view.mjs';
2
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../libs/calendar/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,83 @@
1
+ import type { CalendarView, ListCalendar, Locale, Page, RecordId, Values } from '@fieldia/core';
2
+ import type { CalendarEvent, Resource } from './events.mjs';
3
+ import type { CalendarLabels } from './labels.mjs';
4
+ /** A column of the day or the week: a day, and a person or room when the day shows one each. */
5
+ export interface Column {
6
+ day: Date;
7
+ resource: (Resource & {
8
+ label: string;
9
+ }) | null;
10
+ }
11
+ /** Where the slots' and the days' one stop is: a day, a time, a column. */
12
+ export interface Cursor {
13
+ day: Date;
14
+ minutes: number;
15
+ column: number;
16
+ }
17
+ /** What a calendar shows now, which its drawing, its gestures, its keys and Move to… all read and set. */
18
+ export interface CalendarState {
19
+ view: CalendarView;
20
+ /** A day in the span shown. */
21
+ anchor: Date;
22
+ cursor: Cursor;
23
+ /** The day's or the week's columns, as last drawn. */
24
+ columns: Column[];
25
+ /** The hours shown: the page's, stretched to the records outside them. */
26
+ shownHours: {
27
+ start: number;
28
+ end: number;
29
+ };
30
+ /** The people or rooms the day shows a column for; null alone when it shows none. */
31
+ resources: Column['resource'][];
32
+ }
33
+ /** How many whole lines of words a record's block of this height shows under its 2 pixels of padding: one at least. */
34
+ export declare const linesIn: (height: number) => number;
35
+ /** An element with its attributes (those undefined left off) and its children. */
36
+ export type Make = <K extends keyof HTMLElementTagNameMap>(tag: K, attrs?: Record<string, string | undefined>, ...children: (Node | string)[]) => HTMLElementTagNameMap[K];
37
+ export declare const maker: (doc: Document) => Make;
38
+ /**
39
+ * One calendar as its parts in other files reach it (gestures.ts, keys.ts,
40
+ * move-to.ts): what it was made with, what it shows now, and what it does —
41
+ * draw, ask again, open, make, write a move.
42
+ */
43
+ export interface CalendarCore {
44
+ /** Its own prefix for ids: "fd-cal-1". */
45
+ readonly id: string;
46
+ readonly doc: Document;
47
+ readonly element: HTMLElement;
48
+ /** Where the day, the week, the month or the agenda is drawn. */
49
+ readonly body: HTMLElement;
50
+ readonly page: Page;
51
+ readonly spec: ListCalendar;
52
+ readonly locale: Locale;
53
+ readonly labels: CalendarLabels;
54
+ /** The minutes a slot holds, and a drag moves by. */
55
+ readonly slot: number;
56
+ /** The pixels an hour takes in the day and the week. */
57
+ readonly hour: number;
58
+ /** The week's first day, 0 Sunday to 6 Saturday. */
59
+ readonly firstDay: number;
60
+ readonly canOpen: boolean;
61
+ readonly state: CalendarState;
62
+ readonly make: Make;
63
+ /** Whether the page reads right to left. */
64
+ rtl(): boolean;
65
+ /** A moment's time, as the calendar writes one: "14:30". */
66
+ time(d: Date): string;
67
+ /** The part of an event on one day; null when it has none there. */
68
+ segment(event: CalendarEvent, day: Date): {
69
+ start: Date;
70
+ end: Date;
71
+ } | null;
72
+ /** Minutes kept to a slot's start inside the hours shown. */
73
+ clampMinutes(minutes: number): number;
74
+ draw(): void;
75
+ reload(): Promise<void>;
76
+ open(event: CalendarEvent): void;
77
+ createAt(start: Date, end: Date | null, column: Column | null, wholeDay?: boolean): Promise<void>;
78
+ /** Write a move through the data source's save, with Undo, and say so in these words: whether it was saved. */
79
+ commit(event: CalendarEvent, values: Values, words: string): Promise<boolean>;
80
+ /** Where a record is now, for the keys to stand on: its block on that day, any of its blocks, the "+N more" that holds it, or the bar's step toward that day. */
81
+ place(id: RecordId, day: Date): HTMLElement;
82
+ openMove(event: CalendarEvent, target: HTMLElement): void;
83
+ }
@@ -0,0 +1,83 @@
1
+ import type { CalendarView, ListCalendar, Locale, Page, RecordId, Values } from '@fieldia/core';
2
+ import type { CalendarEvent, Resource } from './events';
3
+ import type { CalendarLabels } from './labels';
4
+ /** A column of the day or the week: a day, and a person or room when the day shows one each. */
5
+ export interface Column {
6
+ day: Date;
7
+ resource: (Resource & {
8
+ label: string;
9
+ }) | null;
10
+ }
11
+ /** Where the slots' and the days' one stop is: a day, a time, a column. */
12
+ export interface Cursor {
13
+ day: Date;
14
+ minutes: number;
15
+ column: number;
16
+ }
17
+ /** What a calendar shows now, which its drawing, its gestures, its keys and Move to… all read and set. */
18
+ export interface CalendarState {
19
+ view: CalendarView;
20
+ /** A day in the span shown. */
21
+ anchor: Date;
22
+ cursor: Cursor;
23
+ /** The day's or the week's columns, as last drawn. */
24
+ columns: Column[];
25
+ /** The hours shown: the page's, stretched to the records outside them. */
26
+ shownHours: {
27
+ start: number;
28
+ end: number;
29
+ };
30
+ /** The people or rooms the day shows a column for; null alone when it shows none. */
31
+ resources: Column['resource'][];
32
+ }
33
+ /** How many whole lines of words a record's block of this height shows under its 2 pixels of padding: one at least. */
34
+ export declare const linesIn: (height: number) => number;
35
+ /** An element with its attributes (those undefined left off) and its children. */
36
+ export type Make = <K extends keyof HTMLElementTagNameMap>(tag: K, attrs?: Record<string, string | undefined>, ...children: (Node | string)[]) => HTMLElementTagNameMap[K];
37
+ export declare const maker: (doc: Document) => Make;
38
+ /**
39
+ * One calendar as its parts in other files reach it (gestures.ts, keys.ts,
40
+ * move-to.ts): what it was made with, what it shows now, and what it does —
41
+ * draw, ask again, open, make, write a move.
42
+ */
43
+ export interface CalendarCore {
44
+ /** Its own prefix for ids: "fd-cal-1". */
45
+ readonly id: string;
46
+ readonly doc: Document;
47
+ readonly element: HTMLElement;
48
+ /** Where the day, the week, the month or the agenda is drawn. */
49
+ readonly body: HTMLElement;
50
+ readonly page: Page;
51
+ readonly spec: ListCalendar;
52
+ readonly locale: Locale;
53
+ readonly labels: CalendarLabels;
54
+ /** The minutes a slot holds, and a drag moves by. */
55
+ readonly slot: number;
56
+ /** The pixels an hour takes in the day and the week. */
57
+ readonly hour: number;
58
+ /** The week's first day, 0 Sunday to 6 Saturday. */
59
+ readonly firstDay: number;
60
+ readonly canOpen: boolean;
61
+ readonly state: CalendarState;
62
+ readonly make: Make;
63
+ /** Whether the page reads right to left. */
64
+ rtl(): boolean;
65
+ /** A moment's time, as the calendar writes one: "14:30". */
66
+ time(d: Date): string;
67
+ /** The part of an event on one day; null when it has none there. */
68
+ segment(event: CalendarEvent, day: Date): {
69
+ start: Date;
70
+ end: Date;
71
+ } | null;
72
+ /** Minutes kept to a slot's start inside the hours shown. */
73
+ clampMinutes(minutes: number): number;
74
+ draw(): void;
75
+ reload(): Promise<void>;
76
+ open(event: CalendarEvent): void;
77
+ createAt(start: Date, end: Date | null, column: Column | null, wholeDay?: boolean): Promise<void>;
78
+ /** Write a move through the data source's save, with Undo, and say so in these words: whether it was saved. */
79
+ commit(event: CalendarEvent, values: Values, words: string): Promise<boolean>;
80
+ /** Where a record is now, for the keys to stand on: its block on that day, any of its blocks, the "+N more" that holds it, or the bar's step toward that day. */
81
+ place(id: RecordId, day: Date): HTMLElement;
82
+ openMove(event: CalendarEvent, target: HTMLElement): void;
83
+ }
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.maker = exports.linesIn = void 0;
4
+ /** A line of a record's words in the hours, in pixels: the stylesheet's line-height there (styles.ts). */
5
+ const LINE = 16;
6
+ /** How many whole lines of words a record's block of this height shows under its 2 pixels of padding: one at least. */
7
+ const linesIn = (height) => Math.max(1, Math.floor((height - 2) / LINE));
8
+ exports.linesIn = linesIn;
9
+ const maker = (doc) => (tag, attrs = {}, ...children) => {
10
+ const node = doc.createElement(tag);
11
+ for (const [key, value] of Object.entries(attrs))
12
+ if (value !== undefined)
13
+ node.setAttribute(key, value);
14
+ node.append(...children);
15
+ return node;
16
+ };
17
+ exports.maker = maker;
18
+ //# sourceMappingURL=calendar-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-core.js","sourceRoot":"","sources":["../../../../../libs/calendar/src/lib/calendar-core.ts"],"names":[],"mappings":";;;AA+BA,0GAA0G;AAC1G,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,uHAAuH;AAChH,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AAA3E,QAAA,OAAO,WAAoE;AAKjF,MAAM,KAAK,GAChB,CAAC,GAAa,EAAQ,EAAE,CACxB,CAAC,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,QAAQ,EAAE,EAAE;IAC/B,MAAM,IAAI,GAAG,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACpC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACzG,IAAI,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC;IACzB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAPS,QAAA,KAAK,SAOd"}
@@ -0,0 +1,13 @@
1
+ /** A line of a record's words in the hours, in pixels: the stylesheet's line-height there (styles.ts). */
2
+ const LINE = 16;
3
+ /** How many whole lines of words a record's block of this height shows under its 2 pixels of padding: one at least. */
4
+ export const linesIn = (height) => Math.max(1, Math.floor((height - 2) / LINE));
5
+ export const maker = (doc) => (tag, attrs = {}, ...children) => {
6
+ const node = doc.createElement(tag);
7
+ for (const [key, value] of Object.entries(attrs))
8
+ if (value !== undefined)
9
+ node.setAttribute(key, value);
10
+ node.append(...children);
11
+ return node;
12
+ };
13
+ //# sourceMappingURL=calendar-core.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-core.mjs","sourceRoot":"","sources":["../../../../../libs/calendar/src/lib/calendar-core.ts"],"names":[],"mappings":"AA+BA,0GAA0G;AAC1G,MAAM,IAAI,GAAG,EAAE,CAAC;AAChB,uHAAuH;AACvH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,MAAc,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AAKxF,MAAM,CAAC,MAAM,KAAK,GAChB,CAAC,GAAa,EAAQ,EAAE,CACxB,CAAC,GAAG,EAAE,KAAK,GAAG,EAAE,EAAE,GAAG,QAAQ,EAAE,EAAE;IAC/B,MAAM,IAAI,GAAG,GAAG,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IACpC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,IAAI,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IACzG,IAAI,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,CAAC;IACzB,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ListViewContext, ListViewPart } from '@fieldia/viewer';
2
+ import type { CalendarSettings } from './settings.mjs';
3
+ /**
4
+ * A list's records on a calendar, for the list's switcher: the list's own
5
+ * search, its records by day, week or month, or as an agenda; a column for
6
+ * each person or room in the day view; dragged to move and stretched by
7
+ * their end (gestures.ts), or moved from the keyboard (keys.ts) with "Move
8
+ * to…" (move-to.ts), written through the data source's save with Undo; an
9
+ * empty slot pressed for a new record.
10
+ */
11
+ export declare function calendarPart(context: ListViewContext, settings?: CalendarSettings): ListViewPart;
@@ -0,0 +1,11 @@
1
+ import type { ListViewContext, ListViewPart } from '@fieldia/viewer';
2
+ import type { CalendarSettings } from './settings';
3
+ /**
4
+ * A list's records on a calendar, for the list's switcher: the list's own
5
+ * search, its records by day, week or month, or as an agenda; a column for
6
+ * each person or room in the day view; dragged to move and stretched by
7
+ * their end (gestures.ts), or moved from the keyboard (keys.ts) with "Move
8
+ * to…" (move-to.ts), written through the data source's save with Undo; an
9
+ * empty slot pressed for a new record.
10
+ */
11
+ export declare function calendarPart(context: ListViewContext, settings?: CalendarSettings): ListViewPart;