@activecollab/components 2.0.576 → 2.0.578
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/dist/cjs/presentation/myWork/MyWorkTasks.js +83 -30
- package/dist/cjs/presentation/myWork/MyWorkTasks.js.map +1 -1
- package/dist/cjs/presentation/myWork/agendaGrid.js +1095 -0
- package/dist/cjs/presentation/myWork/agendaGrid.js.map +1 -0
- package/dist/cjs/presentation/reports/allReports.js +6 -0
- package/dist/cjs/presentation/reports/allReports.js.map +1 -1
- package/dist/cjs/presentation/reports/controls.js +6 -3
- package/dist/cjs/presentation/reports/controls.js.map +1 -1
- package/dist/cjs/presentation/reports/expenses.js +946 -0
- package/dist/cjs/presentation/reports/expenses.js.map +1 -0
- package/dist/cjs/presentation/shared/settings.js +6 -2
- package/dist/cjs/presentation/shared/settings.js.map +1 -1
- package/dist/cjs/presentation/shared/tokens.js +8 -1
- package/dist/cjs/presentation/shared/tokens.js.map +1 -1
- package/dist/cjs/presentation/timeboxes/AdjustmentList.js +31 -0
- package/dist/cjs/presentation/timeboxes/AdjustmentList.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/AgendaDayView.js +1722 -0
- package/dist/cjs/presentation/timeboxes/AgendaDayView.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/CapacityBar.js +54 -0
- package/dist/cjs/presentation/timeboxes/CapacityBar.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/SimulationCard.js +47 -0
- package/dist/cjs/presentation/timeboxes/SimulationCard.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/SimulationPanel.js +319 -0
- package/dist/cjs/presentation/timeboxes/SimulationPanel.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js +206 -0
- package/dist/cjs/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/WorkloadView.js +887 -0
- package/dist/cjs/presentation/timeboxes/WorkloadView.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js +699 -0
- package/dist/cjs/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/changes.js +293 -0
- package/dist/cjs/presentation/timeboxes/changes.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/mockData.js +320 -0
- package/dist/cjs/presentation/timeboxes/mockData.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/model.js +186 -0
- package/dist/cjs/presentation/timeboxes/model.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/pillLook.js +72 -0
- package/dist/cjs/presentation/timeboxes/pillLook.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/plan.js +181 -0
- package/dist/cjs/presentation/timeboxes/plan.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/reducer.js +763 -0
- package/dist/cjs/presentation/timeboxes/reducer.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/scheduler.js +147 -0
- package/dist/cjs/presentation/timeboxes/scheduler.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/store.js +65 -0
- package/dist/cjs/presentation/timeboxes/store.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/timeBlocks.js +1931 -0
- package/dist/cjs/presentation/timeboxes/timeBlocks.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/timeboxSettings.js +369 -0
- package/dist/cjs/presentation/timeboxes/timeboxSettings.js.map +1 -0
- package/dist/cjs/presentation/timeboxes/tracked.js +189 -0
- package/dist/cjs/presentation/timeboxes/tracked.js.map +1 -0
- package/dist/esm/presentation/myWork/MyWorkTasks.d.ts +81 -1
- package/dist/esm/presentation/myWork/MyWorkTasks.d.ts.map +1 -1
- package/dist/esm/presentation/myWork/MyWorkTasks.js +76 -23
- package/dist/esm/presentation/myWork/MyWorkTasks.js.map +1 -1
- package/dist/esm/presentation/myWork/agendaGrid.d.ts +341 -0
- package/dist/esm/presentation/myWork/agendaGrid.d.ts.map +1 -0
- package/dist/esm/presentation/myWork/agendaGrid.js +1001 -0
- package/dist/esm/presentation/myWork/agendaGrid.js.map +1 -0
- package/dist/esm/presentation/reports/allReports.d.ts.map +1 -1
- package/dist/esm/presentation/reports/allReports.js +6 -0
- package/dist/esm/presentation/reports/allReports.js.map +1 -1
- package/dist/esm/presentation/reports/controls.d.ts +3 -1
- package/dist/esm/presentation/reports/controls.d.ts.map +1 -1
- package/dist/esm/presentation/reports/controls.js +6 -3
- package/dist/esm/presentation/reports/controls.js.map +1 -1
- package/dist/esm/presentation/reports/expenses.d.ts +62 -0
- package/dist/esm/presentation/reports/expenses.d.ts.map +1 -0
- package/dist/esm/presentation/reports/expenses.js +849 -0
- package/dist/esm/presentation/reports/expenses.js.map +1 -0
- package/dist/esm/presentation/shared/settings.d.ts +2 -0
- package/dist/esm/presentation/shared/settings.d.ts.map +1 -1
- package/dist/esm/presentation/shared/settings.js +5 -1
- package/dist/esm/presentation/shared/settings.js.map +1 -1
- package/dist/esm/presentation/shared/tokens.d.ts +6 -0
- package/dist/esm/presentation/shared/tokens.d.ts.map +1 -1
- package/dist/esm/presentation/shared/tokens.js +7 -0
- package/dist/esm/presentation/shared/tokens.js.map +1 -1
- package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts +11 -0
- package/dist/esm/presentation/timeboxes/AdjustmentList.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/AdjustmentList.js +22 -0
- package/dist/esm/presentation/timeboxes/AdjustmentList.js.map +1 -0
- package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts +15 -0
- package/dist/esm/presentation/timeboxes/AgendaDayView.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/AgendaDayView.js +1524 -0
- package/dist/esm/presentation/timeboxes/AgendaDayView.js.map +1 -0
- package/dist/esm/presentation/timeboxes/CapacityBar.d.ts +15 -0
- package/dist/esm/presentation/timeboxes/CapacityBar.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/CapacityBar.js +48 -0
- package/dist/esm/presentation/timeboxes/CapacityBar.js.map +1 -0
- package/dist/esm/presentation/timeboxes/SimulationCard.d.ts +13 -0
- package/dist/esm/presentation/timeboxes/SimulationCard.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/SimulationCard.js +41 -0
- package/dist/esm/presentation/timeboxes/SimulationCard.js.map +1 -0
- package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts +18 -0
- package/dist/esm/presentation/timeboxes/SimulationPanel.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/SimulationPanel.js +267 -0
- package/dist/esm/presentation/timeboxes/SimulationPanel.js.map +1 -0
- package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts +14 -0
- package/dist/esm/presentation/timeboxes/TimeRecordsSection.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/TimeRecordsSection.js +159 -0
- package/dist/esm/presentation/timeboxes/TimeRecordsSection.js.map +1 -0
- package/dist/esm/presentation/timeboxes/WorkloadView.d.ts +9 -0
- package/dist/esm/presentation/timeboxes/WorkloadView.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/WorkloadView.js +761 -0
- package/dist/esm/presentation/timeboxes/WorkloadView.js.map +1 -0
- package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts +2 -0
- package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js +640 -0
- package/dist/esm/presentation/timeboxes/__tests__/timeboxes.test.js.map +1 -0
- package/dist/esm/presentation/timeboxes/changes.d.ts +72 -0
- package/dist/esm/presentation/timeboxes/changes.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/changes.js +224 -0
- package/dist/esm/presentation/timeboxes/changes.js.map +1 -0
- package/dist/esm/presentation/timeboxes/mockData.d.ts +16 -0
- package/dist/esm/presentation/timeboxes/mockData.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/mockData.js +297 -0
- package/dist/esm/presentation/timeboxes/mockData.js.map +1 -0
- package/dist/esm/presentation/timeboxes/model.d.ts +136 -0
- package/dist/esm/presentation/timeboxes/model.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/model.js +129 -0
- package/dist/esm/presentation/timeboxes/model.js.map +1 -0
- package/dist/esm/presentation/timeboxes/pillLook.d.ts +40 -0
- package/dist/esm/presentation/timeboxes/pillLook.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/pillLook.js +65 -0
- package/dist/esm/presentation/timeboxes/pillLook.js.map +1 -0
- package/dist/esm/presentation/timeboxes/plan.d.ts +62 -0
- package/dist/esm/presentation/timeboxes/plan.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/plan.js +116 -0
- package/dist/esm/presentation/timeboxes/plan.js.map +1 -0
- package/dist/esm/presentation/timeboxes/reducer.d.ts +203 -0
- package/dist/esm/presentation/timeboxes/reducer.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/reducer.js +616 -0
- package/dist/esm/presentation/timeboxes/reducer.js.map +1 -0
- package/dist/esm/presentation/timeboxes/scheduler.d.ts +63 -0
- package/dist/esm/presentation/timeboxes/scheduler.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/scheduler.js +120 -0
- package/dist/esm/presentation/timeboxes/scheduler.js.map +1 -0
- package/dist/esm/presentation/timeboxes/store.d.ts +23 -0
- package/dist/esm/presentation/timeboxes/store.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/store.js +46 -0
- package/dist/esm/presentation/timeboxes/store.js.map +1 -0
- package/dist/esm/presentation/timeboxes/timeBlocks.d.ts +10 -0
- package/dist/esm/presentation/timeboxes/timeBlocks.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/timeBlocks.js +1767 -0
- package/dist/esm/presentation/timeboxes/timeBlocks.js.map +1 -0
- package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts +71 -0
- package/dist/esm/presentation/timeboxes/timeboxSettings.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/timeboxSettings.js +302 -0
- package/dist/esm/presentation/timeboxes/timeboxSettings.js.map +1 -0
- package/dist/esm/presentation/timeboxes/tracked.d.ts +51 -0
- package/dist/esm/presentation/timeboxes/tracked.d.ts.map +1 -0
- package/dist/esm/presentation/timeboxes/tracked.js +136 -0
- package/dist/esm/presentation/timeboxes/tracked.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The calendar look the app has under the new_task flag, for tasks and
|
|
3
|
+
* events in the hour grid (the Time Blocks concept's "new_task design
|
|
4
|
+
* proposal", shared here): every item is the app's pill filled with its
|
|
5
|
+
* palette colour (calendar.less .rbc-event with .calendar-event-fill), a
|
|
6
|
+
* suggestion keeps a lighter, see-through hatch of it.
|
|
7
|
+
*/
|
|
8
|
+
/** A colour as the palette shows it: its hue's base colour, and that hue's
|
|
9
|
+
dark ink. */
|
|
10
|
+
export declare const paletteOf: (color: string) => {
|
|
11
|
+
base: string;
|
|
12
|
+
ink: string;
|
|
13
|
+
};
|
|
14
|
+
/** A palette colour's fill on the paper; events and tasks take the
|
|
15
|
+
stronger share, cards the lighter one. */
|
|
16
|
+
export declare const paletteFill: (base: string, kind?: "event" | "card") => string;
|
|
17
|
+
/** A suggestion: the colour's hatch, about half a pill's strength and
|
|
18
|
+
see-through; a linked fragment's hatch steps up a little. */
|
|
19
|
+
export declare const tentativeHatch: (base: string, linked: boolean) => string;
|
|
20
|
+
/** An event without the user (calendar-event-muted): neutral fill, its
|
|
21
|
+
colour on the leading edge only. */
|
|
22
|
+
export declare const MUTED_EVENT_FILL = "color-mix(in srgb, var(--color-theme-900) 9%, var(--page-paper-main))";
|
|
23
|
+
/** The 1px of paper between neighbouring fills (calendar.less). */
|
|
24
|
+
export declare const PAPER_RING = "0 0 0 1px var(--page-paper-main)";
|
|
25
|
+
/**
|
|
26
|
+
* The pill: 4px radius, a transparent 1px border with the 3px leading edge,
|
|
27
|
+
* the content 4px in; a name line, then a detail line (times, fragments,
|
|
28
|
+
* overlaps) that a one-line pill drops. Secondary text on a fill follows the
|
|
29
|
+
* primary one (.calendar-event-fill .event-time).
|
|
30
|
+
*/
|
|
31
|
+
export declare const PILL_LOOK: import("styled-components").FlattenSimpleInterpolation;
|
|
32
|
+
/**
|
|
33
|
+
* Tracked time: a darker step of the pill's colour, as Timeline's
|
|
34
|
+
* TaskBar progress fill is a stronger rung of the bar's hue. On the light
|
|
35
|
+
* papers the palette colour itself (the pill is its 40% share); on the dark
|
|
36
|
+
* ones its hue's ink, darker than the pill's 38% share, so the light text
|
|
37
|
+
* keeps its contrast.
|
|
38
|
+
*/
|
|
39
|
+
export declare const trackedFillColor: (color: string) => string;
|
|
40
|
+
//# sourceMappingURL=pillLook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pillLook.d.ts","sourceRoot":"","sources":["../../../../src/presentation/timeboxes/pillLook.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AAEH;gBACgB;AAChB,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAIpE,CAAC;AAEF;6CAC6C;AAC7C,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,OAAM,OAAO,GAAG,MAAgB,WAC3C,CAAC;AAEhC;gEACgE;AAChE,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,QAAQ,OAAO,KAAG,MAKlC,CAAC;AAE9B;uCACuC;AACvC,eAAO,MAAM,gBAAgB,0EAC4C,CAAC;AAE1E,mEAAmE;AACnE,eAAO,MAAM,UAAU,qCAAqC,CAAC;AAE7D;;;;;GAKG;AACH,eAAO,MAAM,SAAS,wDA+ErB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,KAAG,MAGhD,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { css } from "styled-components";
|
|
2
|
+
import { SWATCH_PALETTE_HUES, swatchPaletteBaseOf, swatchPaletteFill } from "../../components/SwatchPalette";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The calendar look the app has under the new_task flag, for tasks and
|
|
6
|
+
* events in the hour grid (the Time Blocks concept's "new_task design
|
|
7
|
+
* proposal", shared here): every item is the app's pill filled with its
|
|
8
|
+
* palette colour (calendar.less .rbc-event with .calendar-event-fill), a
|
|
9
|
+
* suggestion keeps a lighter, see-through hatch of it.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** A colour as the palette shows it: its hue's base colour, and that hue's
|
|
13
|
+
dark ink. */
|
|
14
|
+
export const paletteOf = color => {
|
|
15
|
+
var _hue$ink;
|
|
16
|
+
const base = swatchPaletteBaseOf(color);
|
|
17
|
+
const hue = SWATCH_PALETTE_HUES.find(entry => entry.soft === base);
|
|
18
|
+
return {
|
|
19
|
+
base,
|
|
20
|
+
ink: (_hue$ink = hue == null ? void 0 : hue.ink) != null ? _hue$ink : base
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** A palette colour's fill on the paper; events and tasks take the
|
|
25
|
+
stronger share, cards the lighter one. */
|
|
26
|
+
export const paletteFill = function (base, kind) {
|
|
27
|
+
if (kind === void 0) {
|
|
28
|
+
kind = "event";
|
|
29
|
+
}
|
|
30
|
+
return swatchPaletteFill(base, kind);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/** A suggestion: the colour's hatch, about half a pill's strength and
|
|
34
|
+
see-through; a linked fragment's hatch steps up a little. */
|
|
35
|
+
export const tentativeHatch = (base, linked) => "repeating-linear-gradient(135deg, color-mix(in srgb, " + base + " " + (linked ? 32 : 22) + "%, transparent) 0 6px, color-mix(in srgb, " + base + " " + (linked ? 14 : 8) + "%, transparent) 6px 12px)";
|
|
36
|
+
|
|
37
|
+
/** An event without the user (calendar-event-muted): neutral fill, its
|
|
38
|
+
colour on the leading edge only. */
|
|
39
|
+
export const MUTED_EVENT_FILL = "color-mix(in srgb, var(--color-theme-900) 9%, var(--page-paper-main))";
|
|
40
|
+
|
|
41
|
+
/** The 1px of paper between neighbouring fills (calendar.less). */
|
|
42
|
+
export const PAPER_RING = "0 0 0 1px var(--page-paper-main)";
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* The pill: 4px radius, a transparent 1px border with the 3px leading edge,
|
|
46
|
+
* the content 4px in; a name line, then a detail line (times, fragments,
|
|
47
|
+
* overlaps) that a one-line pill drops. Secondary text on a fill follows the
|
|
48
|
+
* primary one (.calendar-event-fill .event-time).
|
|
49
|
+
*/
|
|
50
|
+
export const PILL_LOOK = css(["box-sizing:border-box;position:absolute;display:flex;flex-direction:column;min-height:20px;padding:3px 4px;border-style:solid;border-width:1px 1px 1px 3px;border-color:transparent;border-radius:var(--ac-br-4);overflow:hidden;z-index:1;&.compact{justify-content:center;padding-top:0;padding-bottom:0;}&& .fill-text{color:color-mix(in srgb,var(--color-theme-900) 80%,transparent);}.block-line,.block-detail{display:flex;align-items:center;gap:4px;min-width:0;}.block-detail{white-space:nowrap;}&.compact .block-detail{display:none;}.block-glyph{display:flex;flex-shrink:0;}.block-name{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.block-meta{flex-shrink:0;}.fragment-dots{display:inline-flex;gap:3px;}.fragment-dot{width:5px;height:5px;border-radius:var(--ac-br-rounded);border:1px solid;}.overlap-chip{display:inline-flex;align-items:center;gap:4px;min-width:0;padding:0 6px;border-radius:var(--ac-br-rounded);background-color:var(--alert-surface);}"]);
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Tracked time: a darker step of the pill's colour, as Timeline's
|
|
54
|
+
* TaskBar progress fill is a stronger rung of the bar's hue. On the light
|
|
55
|
+
* papers the palette colour itself (the pill is its 40% share); on the dark
|
|
56
|
+
* ones its hue's ink, darker than the pill's 38% share, so the light text
|
|
57
|
+
* keeps its contrast.
|
|
58
|
+
*/
|
|
59
|
+
export const trackedFillColor = color => {
|
|
60
|
+
const _paletteOf = paletteOf(color),
|
|
61
|
+
base = _paletteOf.base,
|
|
62
|
+
ink = _paletteOf.ink;
|
|
63
|
+
return "light-dark(color-mix(in srgb, " + base + " 85%, var(--page-paper-main)), color-mix(in srgb, " + ink + " 75%, var(--page-paper-main)))";
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=pillLook.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pillLook.js","names":["css","SWATCH_PALETTE_HUES","swatchPaletteBaseOf","swatchPaletteFill","paletteOf","color","_hue$ink","base","hue","find","entry","soft","ink","paletteFill","kind","tentativeHatch","linked","MUTED_EVENT_FILL","PAPER_RING","PILL_LOOK","trackedFillColor","_paletteOf"],"sources":["../../../../src/presentation/timeboxes/pillLook.ts"],"sourcesContent":["import { css } from \"styled-components\";\n\nimport {\n SWATCH_PALETTE_HUES,\n swatchPaletteBaseOf,\n swatchPaletteFill,\n} from \"../../components/SwatchPalette\";\n\n/**\n * The calendar look the app has under the new_task flag, for tasks and\n * events in the hour grid (the Time Blocks concept's \"new_task design\n * proposal\", shared here): every item is the app's pill filled with its\n * palette colour (calendar.less .rbc-event with .calendar-event-fill), a\n * suggestion keeps a lighter, see-through hatch of it.\n */\n\n/** A colour as the palette shows it: its hue's base colour, and that hue's\n dark ink. */\nexport const paletteOf = (color: string): { base: string; ink: string } => {\n const base = swatchPaletteBaseOf(color);\n const hue = SWATCH_PALETTE_HUES.find((entry) => entry.soft === base);\n return { base, ink: hue?.ink ?? base };\n};\n\n/** A palette colour's fill on the paper; events and tasks take the\n stronger share, cards the lighter one. */\nexport const paletteFill = (base: string, kind: \"event\" | \"card\" = \"event\") =>\n swatchPaletteFill(base, kind);\n\n/** A suggestion: the colour's hatch, about half a pill's strength and\n see-through; a linked fragment's hatch steps up a little. */\nexport const tentativeHatch = (base: string, linked: boolean): string =>\n `repeating-linear-gradient(135deg, color-mix(in srgb, ${base} ${\n linked ? 32 : 22\n }%, transparent) 0 6px, color-mix(in srgb, ${base} ${\n linked ? 14 : 8\n }%, transparent) 6px 12px)`;\n\n/** An event without the user (calendar-event-muted): neutral fill, its\n colour on the leading edge only. */\nexport const MUTED_EVENT_FILL =\n \"color-mix(in srgb, var(--color-theme-900) 9%, var(--page-paper-main))\";\n\n/** The 1px of paper between neighbouring fills (calendar.less). */\nexport const PAPER_RING = \"0 0 0 1px var(--page-paper-main)\";\n\n/**\n * The pill: 4px radius, a transparent 1px border with the 3px leading edge,\n * the content 4px in; a name line, then a detail line (times, fragments,\n * overlaps) that a one-line pill drops. Secondary text on a fill follows the\n * primary one (.calendar-event-fill .event-time).\n */\nexport const PILL_LOOK = css`\n box-sizing: border-box;\n position: absolute;\n display: flex;\n flex-direction: column;\n min-height: 20px;\n padding: 3px 4px;\n border-style: solid;\n border-width: 1px 1px 1px 3px;\n border-color: transparent;\n border-radius: var(--ac-br-4);\n overflow: hidden;\n z-index: 1;\n\n &.compact {\n justify-content: center;\n padding-top: 0;\n padding-bottom: 0;\n }\n\n && .fill-text {\n color: color-mix(in srgb, var(--color-theme-900) 80%, transparent);\n }\n\n .block-line,\n .block-detail {\n display: flex;\n align-items: center;\n gap: 4px;\n min-width: 0;\n }\n\n .block-detail {\n white-space: nowrap;\n }\n\n &.compact .block-detail {\n display: none;\n }\n\n .block-glyph {\n display: flex;\n flex-shrink: 0;\n }\n\n .block-name {\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n\n .block-meta {\n flex-shrink: 0;\n }\n\n /* Fragments of a split suggestion: one dot each, this one filled. */\n .fragment-dots {\n display: inline-flex;\n gap: 3px;\n }\n\n .fragment-dot {\n width: 5px;\n height: 5px;\n border-radius: var(--ac-br-rounded);\n border: 1px solid;\n }\n\n .overlap-chip {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n min-width: 0;\n padding: 0 6px;\n border-radius: var(--ac-br-rounded);\n background-color: var(--alert-surface);\n }\n`;\n\n/**\n * Tracked time: a darker step of the pill's colour, as Timeline's\n * TaskBar progress fill is a stronger rung of the bar's hue. On the light\n * papers the palette colour itself (the pill is its 40% share); on the dark\n * ones its hue's ink, darker than the pill's 38% share, so the light text\n * keeps its contrast.\n */\nexport const trackedFillColor = (color: string): string => {\n const { base, ink } = paletteOf(color);\n return `light-dark(color-mix(in srgb, ${base} 85%, var(--page-paper-main)), color-mix(in srgb, ${ink} 75%, var(--page-paper-main)))`;\n};\n"],"mappings":"AAAA,SAASA,GAAG,QAAQ,mBAAmB;AAEvC,SACEC,mBAAmB,EACnBC,mBAAmB,EACnBC,iBAAiB,QACZ,gCAAgC;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,OAAO,MAAMC,SAAS,GAAIC,KAAa,IAAoC;EAAA,IAAAC,QAAA;EACzE,MAAMC,IAAI,GAAGL,mBAAmB,CAACG,KAAK,CAAC;EACvC,MAAMG,GAAG,GAAGP,mBAAmB,CAACQ,IAAI,CAAEC,KAAK,IAAKA,KAAK,CAACC,IAAI,KAAKJ,IAAI,CAAC;EACpE,OAAO;IAAEA,IAAI;IAAEK,GAAG,GAAAN,QAAA,GAAEE,GAAG,oBAAHA,GAAG,CAAEI,GAAG,YAAAN,QAAA,GAAIC;EAAK,CAAC;AACxC,CAAC;;AAED;AACA;AACA,OAAO,MAAMM,WAAW,GAAG,SAAAA,CAACN,IAAY,EAAEO,IAAsB;EAAA,IAAtBA,IAAsB;IAAtBA,IAAsB,GAAG,OAAO;EAAA;EAAA,OACxEX,iBAAiB,CAACI,IAAI,EAAEO,IAAI,CAAC;AAAA;;AAE/B;AACA;AACA,OAAO,MAAMC,cAAc,GAAGA,CAACR,IAAY,EAAES,MAAe,+DACFT,IAAI,UAC1DS,MAAM,GAAG,EAAE,GAAG,EAAE,mDAC2BT,IAAI,UAC/CS,MAAM,GAAG,EAAE,GAAG,CAAC,+BACU;;AAE7B;AACA;AACA,OAAO,MAAMC,gBAAgB,GAC3B,uEAAuE;;AAEzE;AACA,OAAO,MAAMC,UAAU,GAAG,kCAAkC;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,SAAS,GAAGnB,GAAG,k+BA+E3B;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMoB,gBAAgB,GAAIf,KAAa,IAAa;EACzD,MAAAgB,UAAA,GAAsBjB,SAAS,CAACC,KAAK,CAAC;IAA9BE,IAAI,GAAAc,UAAA,CAAJd,IAAI;IAAEK,GAAG,GAAAS,UAAA,CAAHT,GAAG;EACjB,0CAAwCL,IAAI,0DAAqDK,GAAG;AACtG,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { DateKey, TbEvent, TbPart, TbState, TbTask, TbUser, TimeRange } from "./model";
|
|
2
|
+
import { Suggestion } from "./scheduler";
|
|
3
|
+
/** What the simulations look up: the fixed people and projects. */
|
|
4
|
+
export interface TbContext {
|
|
5
|
+
users: TbUser[];
|
|
6
|
+
}
|
|
7
|
+
export declare const userOf: (context: TbContext, task: TbTask) => TbUser;
|
|
8
|
+
export declare const taskById: (state: TbState, taskId: number) => TbTask;
|
|
9
|
+
export declare const isInRange: (task: TbTask, date: DateKey) => boolean;
|
|
10
|
+
export declare const tasksOfUser: (state: TbState, userId: number) => TbTask[];
|
|
11
|
+
/** A pinned timebox on the day, with what it overlaps. */
|
|
12
|
+
export interface PlannedTimebox {
|
|
13
|
+
part: TbPart;
|
|
14
|
+
task: TbTask;
|
|
15
|
+
range: TimeRange;
|
|
16
|
+
/** Outside the work window. */
|
|
17
|
+
overtime: boolean;
|
|
18
|
+
overlapping: TbEvent[];
|
|
19
|
+
}
|
|
20
|
+
export interface DayPlan {
|
|
21
|
+
date: DateKey;
|
|
22
|
+
window: TimeRange;
|
|
23
|
+
pause: TimeRange | null;
|
|
24
|
+
events: TbEvent[];
|
|
25
|
+
timeboxes: PlannedTimebox[];
|
|
26
|
+
suggestions: Suggestion[];
|
|
27
|
+
unscheduled: {
|
|
28
|
+
taskId: number;
|
|
29
|
+
minutes: number;
|
|
30
|
+
}[];
|
|
31
|
+
/** Tasks on the day without an estimate: All Day pills. */
|
|
32
|
+
withoutEstimate: TbTask[];
|
|
33
|
+
/** Minutes: the user's capacity for the day. */
|
|
34
|
+
capacity: number;
|
|
35
|
+
/** Sum of the open tasks' allocations for the day. */
|
|
36
|
+
allocated: number;
|
|
37
|
+
/** Pinned and suggested minutes inside the work window. */
|
|
38
|
+
scheduled: number;
|
|
39
|
+
/** Overtime suggestions plus what did not fit at all. */
|
|
40
|
+
overbooked: number;
|
|
41
|
+
}
|
|
42
|
+
export declare const eventRange: (event: TbEvent) => TimeRange;
|
|
43
|
+
/**
|
|
44
|
+
* A user's day: the pinned timeboxes as they are, the scheduler's
|
|
45
|
+
* suggestions for every open task's untimed minutes, and the numbers the
|
|
46
|
+
* day header shows. Completed tasks keep their timeboxes and lose their
|
|
47
|
+
* suggestions. Tracked time is ignored.
|
|
48
|
+
*/
|
|
49
|
+
export declare const planDay: (state: TbState, context: TbContext, userId: number, date: DateKey) => DayPlan;
|
|
50
|
+
/** Whether the task's split is per day yet, and its per-day totals. */
|
|
51
|
+
export declare const dailyTotals: (state: TbState, context: TbContext, task: TbTask, days: DateKey[]) => {
|
|
52
|
+
split: boolean;
|
|
53
|
+
totals: Map<DateKey, number>;
|
|
54
|
+
};
|
|
55
|
+
export declare const lastAvailableDay: (task: TbTask, user: TbUser) => DateKey | undefined;
|
|
56
|
+
/** A user's day on the Workload: the open tasks' allocations against the
|
|
57
|
+
day's capacity. */
|
|
58
|
+
export declare const userDayLoad: (state: TbState, context: TbContext, userId: number, date: DateKey) => {
|
|
59
|
+
allocated: number;
|
|
60
|
+
capacity: number;
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../../../src/presentation/timeboxes/plan.ts"],"names":[],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AAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,2DAA2D;IAC3D,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,SAG1C,CAAC;AAQH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAClB,OAAO,OAAO,EACd,SAAS,SAAS,EAClB,QAAQ,MAAM,EACd,MAAM,OAAO,KACZ,OA+FF,CAAC;AAEF,uEAAuE;AACvE,eAAO,MAAM,WAAW,GACtB,OAAO,OAAO,EACd,SAAS,SAAS,EAClB,MAAM,MAAM,EACZ,MAAM,OAAO,EAAE,KACd;IAAE,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;CAShD,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,MAAM,MAAM,EACZ,MAAM,MAAM,KACX,OAAO,GAAG,SAAmD,CAAC;AAEjE;sBACsB;AACtB,eAAO,MAAM,WAAW,GACtB,OAAO,OAAO,EACd,SAAS,SAAS,EAClB,QAAQ,MAAM,EACd,MAAM,OAAO,KACZ;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAOvC,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { MINUTES_PER_DAY, allocationOn, availableDays, capacityOn, clockToMinutes, isSplit, isTimebox, overlaps, rangeOf, untimedOn } from "./model";
|
|
2
|
+
import { schedule, workWindow } from "./scheduler";
|
|
3
|
+
|
|
4
|
+
/** What the simulations look up: the fixed people and projects. */
|
|
5
|
+
|
|
6
|
+
export const userOf = (context, task) => {
|
|
7
|
+
const user = context.users.find(item => item.id === task.assigneeId);
|
|
8
|
+
if (!user) throw new Error("No user " + task.assigneeId);
|
|
9
|
+
return user;
|
|
10
|
+
};
|
|
11
|
+
export const taskById = (state, taskId) => {
|
|
12
|
+
const task = state.tasks.find(item => item.id === taskId);
|
|
13
|
+
if (!task) throw new Error("No task " + taskId);
|
|
14
|
+
return task;
|
|
15
|
+
};
|
|
16
|
+
export const isInRange = (task, date) => task.startOn <= date && task.dueOn >= date;
|
|
17
|
+
export const tasksOfUser = (state, userId) => state.tasks.filter(task => task.assigneeId === userId);
|
|
18
|
+
|
|
19
|
+
/** A pinned timebox on the day, with what it overlaps. */
|
|
20
|
+
|
|
21
|
+
export const eventRange = event => ({
|
|
22
|
+
start: clockToMinutes(event.startsOnTime),
|
|
23
|
+
end: clockToMinutes(event.endsOnTime)
|
|
24
|
+
});
|
|
25
|
+
const insideWindow = (range, window) => Math.max(0, Math.min(range.end, window.end) - Math.max(range.start, window.start));
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* A user's day: the pinned timeboxes as they are, the scheduler's
|
|
29
|
+
* suggestions for every open task's untimed minutes, and the numbers the
|
|
30
|
+
* day header shows. Completed tasks keep their timeboxes and lose their
|
|
31
|
+
* suggestions. Tracked time is ignored.
|
|
32
|
+
*/
|
|
33
|
+
export const planDay = (state, context, userId, date) => {
|
|
34
|
+
const user = context.users.find(item => item.id === userId);
|
|
35
|
+
if (!user) throw new Error("No user " + userId);
|
|
36
|
+
const capacity = capacityOn(user, date);
|
|
37
|
+
const window = workWindow(state.settings.workdayStartsAt, capacity);
|
|
38
|
+
const pause = state.settings.pause ? {
|
|
39
|
+
start: clockToMinutes(state.settings.pause.startsAt),
|
|
40
|
+
end: Math.min(clockToMinutes(state.settings.pause.startsAt) + state.settings.pause.minutes, MINUTES_PER_DAY)
|
|
41
|
+
} : null;
|
|
42
|
+
const events = state.events.filter(event => event.date === date);
|
|
43
|
+
const tasks = tasksOfUser(state, userId);
|
|
44
|
+
const timeboxes = state.parts.filter(part => part.date === date && isTimebox(part)).flatMap(part => {
|
|
45
|
+
const task = tasks.find(item => item.id === part.taskId);
|
|
46
|
+
if (!task) return [];
|
|
47
|
+
const range = rangeOf(part);
|
|
48
|
+
return [{
|
|
49
|
+
part,
|
|
50
|
+
task,
|
|
51
|
+
range,
|
|
52
|
+
overtime: range.start < window.start || range.end > window.end,
|
|
53
|
+
overlapping: events.filter(event => overlaps(range, eventRange(event)))
|
|
54
|
+
}];
|
|
55
|
+
}).sort((a, b) => a.range.start - b.range.start);
|
|
56
|
+
const openOnDay = tasks.filter(task => !task.isCompleted && isInRange(task, date));
|
|
57
|
+
const result = schedule({
|
|
58
|
+
windowStart: window.start,
|
|
59
|
+
windowEnd: window.end,
|
|
60
|
+
busy: [...events.map(eventRange), ...timeboxes.map(timebox => timebox.range), ...(pause ? [pause] : [])],
|
|
61
|
+
demands: openOnDay.filter(task => task.estimate !== null).map(task => ({
|
|
62
|
+
taskId: task.id,
|
|
63
|
+
minutes: Math.max(0, untimedOn(state, task, user, date)),
|
|
64
|
+
isImportant: task.isImportant,
|
|
65
|
+
dueOn: task.dueOn,
|
|
66
|
+
position: task.position
|
|
67
|
+
})),
|
|
68
|
+
minGap: state.settings.minGapMinutes
|
|
69
|
+
});
|
|
70
|
+
const allocated = openOnDay.reduce((total, task) => total + allocationOn(state, task, user, date), 0);
|
|
71
|
+
const scheduled = timeboxes.filter(timebox => !timebox.task.isCompleted).reduce((total, timebox) => total + insideWindow(timebox.range, window), 0) + result.suggestions.filter(suggestion => !suggestion.overtime).reduce((total, item) => total + item.end - item.start, 0);
|
|
72
|
+
const overbooked = result.suggestions.filter(suggestion => suggestion.overtime).reduce((total, item) => total + item.end - item.start, 0) + result.unscheduled.reduce((total, item) => total + item.minutes, 0);
|
|
73
|
+
return {
|
|
74
|
+
date,
|
|
75
|
+
window,
|
|
76
|
+
pause,
|
|
77
|
+
events,
|
|
78
|
+
timeboxes,
|
|
79
|
+
suggestions: result.suggestions,
|
|
80
|
+
unscheduled: result.unscheduled,
|
|
81
|
+
withoutEstimate: openOnDay.filter(task => task.estimate === null),
|
|
82
|
+
capacity,
|
|
83
|
+
allocated,
|
|
84
|
+
scheduled,
|
|
85
|
+
overbooked
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/** Whether the task's split is per day yet, and its per-day totals. */
|
|
90
|
+
export const dailyTotals = (state, context, task, days) => {
|
|
91
|
+
const user = userOf(context, task);
|
|
92
|
+
const totals = new Map();
|
|
93
|
+
days.forEach(date => {
|
|
94
|
+
if (isInRange(task, date)) {
|
|
95
|
+
totals.set(date, allocationOn(state, task, user, date));
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
return {
|
|
99
|
+
split: isSplit(state, task.id),
|
|
100
|
+
totals
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
export const lastAvailableDay = (task, user) => availableDays(task, user).slice(-1)[0];
|
|
104
|
+
|
|
105
|
+
/** A user's day on the Workload: the open tasks' allocations against the
|
|
106
|
+
day's capacity. */
|
|
107
|
+
export const userDayLoad = (state, context, userId, date) => {
|
|
108
|
+
const user = context.users.find(item => item.id === userId);
|
|
109
|
+
if (!user) throw new Error("No user " + userId);
|
|
110
|
+
const allocated = tasksOfUser(state, userId).filter(task => !task.isCompleted && isInRange(task, date)).reduce((total, task) => total + allocationOn(state, task, user, date), 0);
|
|
111
|
+
return {
|
|
112
|
+
allocated,
|
|
113
|
+
capacity: capacityOn(user, date)
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plan.js","names":["MINUTES_PER_DAY","allocationOn","availableDays","capacityOn","clockToMinutes","isSplit","isTimebox","overlaps","rangeOf","untimedOn","schedule","workWindow","userOf","context","task","user","users","find","item","id","assigneeId","Error","taskById","state","taskId","tasks","isInRange","date","startOn","dueOn","tasksOfUser","userId","filter","eventRange","event","start","startsOnTime","end","endsOnTime","insideWindow","range","window","Math","max","min","planDay","capacity","settings","workdayStartsAt","pause","startsAt","minutes","events","timeboxes","parts","part","flatMap","overtime","overlapping","sort","a","b","openOnDay","isCompleted","result","windowStart","windowEnd","busy","map","timebox","demands","estimate","isImportant","position","minGap","minGapMinutes","allocated","reduce","total","scheduled","suggestions","suggestion","overbooked","unscheduled","withoutEstimate","dailyTotals","days","totals","Map","forEach","set","split","lastAvailableDay","slice","userDayLoad"],"sources":["../../../../src/presentation/timeboxes/plan.ts"],"sourcesContent":["import {\n DateKey,\n MINUTES_PER_DAY,\n TbEvent,\n TbPart,\n TbState,\n TbTask,\n TbUser,\n TimeRange,\n allocationOn,\n availableDays,\n capacityOn,\n clockToMinutes,\n isSplit,\n isTimebox,\n overlaps,\n rangeOf,\n untimedOn,\n} from \"./model\";\nimport { Suggestion, schedule, workWindow } from \"./scheduler\";\n\n/** What the simulations look up: the fixed people and projects. */\nexport interface TbContext {\n users: TbUser[];\n}\n\nexport const userOf = (context: TbContext, task: TbTask): TbUser => {\n const user = context.users.find((item) => item.id === task.assigneeId);\n if (!user) throw new Error(`No user ${task.assigneeId}`);\n return user;\n};\n\nexport const taskById = (state: TbState, taskId: number): TbTask => {\n const task = state.tasks.find((item) => item.id === taskId);\n if (!task) throw new Error(`No task ${taskId}`);\n return task;\n};\n\nexport const isInRange = (task: TbTask, date: DateKey): boolean =>\n task.startOn <= date && task.dueOn >= date;\n\nexport const tasksOfUser = (state: TbState, userId: number): TbTask[] =>\n state.tasks.filter((task) => task.assigneeId === userId);\n\n/** A pinned timebox on the day, with what it overlaps. */\nexport interface PlannedTimebox {\n part: TbPart;\n task: TbTask;\n range: TimeRange;\n /** Outside the work window. */\n overtime: boolean;\n overlapping: TbEvent[];\n}\n\nexport interface DayPlan {\n date: DateKey;\n window: TimeRange;\n pause: TimeRange | null;\n events: TbEvent[];\n timeboxes: PlannedTimebox[];\n suggestions: Suggestion[];\n unscheduled: { taskId: number; minutes: number }[];\n /** Tasks on the day without an estimate: All Day pills. */\n withoutEstimate: TbTask[];\n /** Minutes: the user's capacity for the day. */\n capacity: number;\n /** Sum of the open tasks' allocations for the day. */\n allocated: number;\n /** Pinned and suggested minutes inside the work window. */\n scheduled: number;\n /** Overtime suggestions plus what did not fit at all. */\n overbooked: number;\n}\n\nexport const eventRange = (event: TbEvent): TimeRange => ({\n start: clockToMinutes(event.startsOnTime),\n end: clockToMinutes(event.endsOnTime),\n});\n\nconst insideWindow = (range: TimeRange, window: TimeRange): number =>\n Math.max(\n 0,\n Math.min(range.end, window.end) - Math.max(range.start, window.start)\n );\n\n/**\n * A user's day: the pinned timeboxes as they are, the scheduler's\n * suggestions for every open task's untimed minutes, and the numbers the\n * day header shows. Completed tasks keep their timeboxes and lose their\n * suggestions. Tracked time is ignored.\n */\nexport const planDay = (\n state: TbState,\n context: TbContext,\n userId: number,\n date: DateKey\n): DayPlan => {\n const user = context.users.find((item) => item.id === userId);\n if (!user) throw new Error(`No user ${userId}`);\n const capacity = capacityOn(user, date);\n const window = workWindow(state.settings.workdayStartsAt, capacity);\n const pause = state.settings.pause\n ? {\n start: clockToMinutes(state.settings.pause.startsAt),\n end: Math.min(\n clockToMinutes(state.settings.pause.startsAt) +\n state.settings.pause.minutes,\n MINUTES_PER_DAY\n ),\n }\n : null;\n const events = state.events.filter((event) => event.date === date);\n const tasks = tasksOfUser(state, userId);\n\n const timeboxes: PlannedTimebox[] = state.parts\n .filter((part) => part.date === date && isTimebox(part))\n .flatMap((part) => {\n const task = tasks.find((item) => item.id === part.taskId);\n if (!task) return [];\n const range = rangeOf(part);\n return [\n {\n part,\n task,\n range,\n overtime: range.start < window.start || range.end > window.end,\n overlapping: events.filter((event) =>\n overlaps(range, eventRange(event))\n ),\n },\n ];\n })\n .sort((a, b) => a.range.start - b.range.start);\n\n const openOnDay = tasks.filter(\n (task) => !task.isCompleted && isInRange(task, date)\n );\n const result = schedule({\n windowStart: window.start,\n windowEnd: window.end,\n busy: [\n ...events.map(eventRange),\n ...timeboxes.map((timebox) => timebox.range),\n ...(pause ? [pause] : []),\n ],\n demands: openOnDay\n .filter((task) => task.estimate !== null)\n .map((task) => ({\n taskId: task.id,\n minutes: Math.max(0, untimedOn(state, task, user, date)),\n isImportant: task.isImportant,\n dueOn: task.dueOn,\n position: task.position,\n })),\n minGap: state.settings.minGapMinutes,\n });\n\n const allocated = openOnDay.reduce(\n (total, task) => total + allocationOn(state, task, user, date),\n 0\n );\n const scheduled =\n timeboxes\n .filter((timebox) => !timebox.task.isCompleted)\n .reduce(\n (total, timebox) => total + insideWindow(timebox.range, window),\n 0\n ) +\n result.suggestions\n .filter((suggestion) => !suggestion.overtime)\n .reduce((total, item) => total + item.end - item.start, 0);\n const overbooked =\n result.suggestions\n .filter((suggestion) => suggestion.overtime)\n .reduce((total, item) => total + item.end - item.start, 0) +\n result.unscheduled.reduce((total, item) => total + item.minutes, 0);\n\n return {\n date,\n window,\n pause,\n events,\n timeboxes,\n suggestions: result.suggestions,\n unscheduled: result.unscheduled,\n withoutEstimate: openOnDay.filter((task) => task.estimate === null),\n capacity,\n allocated,\n scheduled,\n overbooked,\n };\n};\n\n/** Whether the task's split is per day yet, and its per-day totals. */\nexport const dailyTotals = (\n state: TbState,\n context: TbContext,\n task: TbTask,\n days: DateKey[]\n): { split: boolean; totals: Map<DateKey, number> } => {\n const user = userOf(context, task);\n const totals = new Map<DateKey, number>();\n days.forEach((date) => {\n if (isInRange(task, date)) {\n totals.set(date, allocationOn(state, task, user, date));\n }\n });\n return { split: isSplit(state, task.id), totals };\n};\n\nexport const lastAvailableDay = (\n task: TbTask,\n user: TbUser\n): DateKey | undefined => availableDays(task, user).slice(-1)[0];\n\n/** A user's day on the Workload: the open tasks' allocations against the\n day's capacity. */\nexport const userDayLoad = (\n state: TbState,\n context: TbContext,\n userId: number,\n date: DateKey\n): { allocated: number; capacity: number } => {\n const user = context.users.find((item) => item.id === userId);\n if (!user) throw new Error(`No user ${userId}`);\n const allocated = tasksOfUser(state, userId)\n .filter((task) => !task.isCompleted && isInRange(task, date))\n .reduce((total, task) => total + allocationOn(state, task, user, date), 0);\n return { allocated, capacity: capacityOn(user, date) };\n};\n"],"mappings":"AAAA,SAEEA,eAA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EY,IAAI,CAAC,CAAC;IACzD;EACF,CAAC,CAAC;EACF,OAAO;IAAEgE,KAAK,EAAEtF,OAAO,CAACkB,KAAK,EAAET,IAAI,CAACK,EAAE,CAAC;IAAEoE;EAAO,CAAC;AACnD,CAAC;AAED,OAAO,MAAMK,gBAAgB,GAAGA,CAC9B9E,IAAY,EACZC,IAAY,KACYb,aAAa,CAACY,IAAI,EAAEC,IAAI,CAAC,CAAC8E,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;AAEhE;AACA;AACA,OAAO,MAAMC,WAAW,GAAGA,CACzBvE,KAAc,EACdV,OAAkB,EAClBkB,MAAc,EACdJ,IAAa,KAC+B;EAC5C,MAAMZ,IAAI,GAAGF,OAAO,CAACG,KAAK,CAACC,IAAI,CAAEC,IAAI,IAAKA,IAAI,CAACC,EAAE,KAAKY,MAAM,CAAC;EAC7D,IAAI,CAAChB,IAAI,EAAE,MAAM,IAAIM,KAAK,cAAYU,MAAQ,CAAC;EAC/C,MAAM6C,SAAS,GAAG9C,WAAW,CAACP,KAAK,EAAEQ,MAAM,CAAC,CACzCC,MAAM,CAAElB,IAAI,IAAK,CAACA,IAAI,CAACiD,WAAW,IAAIrC,SAAS,CAACZ,IAAI,EAAEa,IAAI,CAAC,CAAC,CAC5DkD,MAAM,CAAC,CAACC,KAAK,EAAEhE,IAAI,KAAKgE,KAAK,GAAG7E,YAAY,CAACsB,KAAK,EAAET,IAAI,EAAEC,IAAI,EAAEY,IAAI,CAAC,EAAE,CAAC,CAAC;EAC5E,OAAO;IAAEiD,SAAS;IAAE9B,QAAQ,EAAE3C,UAAU,CAACY,IAAI,EAAEY,IAAI;EAAE,CAAC;AACxD,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { TimeboxChange } from "./changes";
|
|
2
|
+
import { DateKey, TbEvent, TbPart, TbSettings, TbState, TbTask, TimeRange } from "./model";
|
|
3
|
+
import { TbContext } from "./plan";
|
|
4
|
+
export type TbAction =
|
|
5
|
+
/** Pin one suggestion; splits the task first when it is not split. */
|
|
6
|
+
{
|
|
7
|
+
type: "pin";
|
|
8
|
+
taskId: number;
|
|
9
|
+
date: DateKey;
|
|
10
|
+
start: number;
|
|
11
|
+
minutes: number;
|
|
12
|
+
}
|
|
13
|
+
/** Pin the day's suggestions in one go. */
|
|
14
|
+
| {
|
|
15
|
+
type: "pinAll";
|
|
16
|
+
date: DateKey;
|
|
17
|
+
suggestions: {
|
|
18
|
+
taskId: number;
|
|
19
|
+
start: number;
|
|
20
|
+
minutes: number;
|
|
21
|
+
}[];
|
|
22
|
+
}
|
|
23
|
+
/** A task dropped on the grid (from the list or the All Day row). */
|
|
24
|
+
| {
|
|
25
|
+
type: "dropTask";
|
|
26
|
+
taskId: number;
|
|
27
|
+
date: DateKey;
|
|
28
|
+
start: number;
|
|
29
|
+
} | {
|
|
30
|
+
type: "moveTimebox";
|
|
31
|
+
partId: string;
|
|
32
|
+
start: number;
|
|
33
|
+
}
|
|
34
|
+
/** New edges; allowIncrease after the user confirmed taking minutes
|
|
35
|
+
from the following days. */
|
|
36
|
+
| {
|
|
37
|
+
type: "resizeTimebox";
|
|
38
|
+
partId: string;
|
|
39
|
+
start: number;
|
|
40
|
+
end: number;
|
|
41
|
+
allowIncrease?: boolean;
|
|
42
|
+
} | {
|
|
43
|
+
type: "unpin";
|
|
44
|
+
partId: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: "editDayValue";
|
|
47
|
+
taskId: number;
|
|
48
|
+
date: DateKey;
|
|
49
|
+
minutes: number;
|
|
50
|
+
} | {
|
|
51
|
+
type: "split";
|
|
52
|
+
taskId: number;
|
|
53
|
+
} | {
|
|
54
|
+
type: "unsplit";
|
|
55
|
+
taskId: number;
|
|
56
|
+
} | {
|
|
57
|
+
type: "setEstimate";
|
|
58
|
+
taskId: number;
|
|
59
|
+
minutes: number | null;
|
|
60
|
+
} | {
|
|
61
|
+
type: "setCompleted";
|
|
62
|
+
taskId: number;
|
|
63
|
+
completed: boolean;
|
|
64
|
+
} | {
|
|
65
|
+
type: "setSubtaskCompleted";
|
|
66
|
+
subtaskId: number;
|
|
67
|
+
completed: boolean;
|
|
68
|
+
} | {
|
|
69
|
+
type: "upsertEvent";
|
|
70
|
+
event: Omit<TbEvent, "id"> & {
|
|
71
|
+
id?: number;
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
type: "removeEvent";
|
|
75
|
+
id: number;
|
|
76
|
+
} | {
|
|
77
|
+
type: "updateSettings";
|
|
78
|
+
settings: Partial<TbSettings>;
|
|
79
|
+
}
|
|
80
|
+
/** Tracked time: whole minutes above 0; it may exceed the plan. */
|
|
81
|
+
| {
|
|
82
|
+
type: "addTimeRecord";
|
|
83
|
+
taskId: number;
|
|
84
|
+
recordDate: DateKey;
|
|
85
|
+
minutes: number;
|
|
86
|
+
/** The task's assignee when left out. */
|
|
87
|
+
userId?: number;
|
|
88
|
+
} | {
|
|
89
|
+
type: "updateTimeRecord";
|
|
90
|
+
id: string;
|
|
91
|
+
minutes: number;
|
|
92
|
+
} | {
|
|
93
|
+
type: "removeTimeRecord";
|
|
94
|
+
id: string;
|
|
95
|
+
};
|
|
96
|
+
/** The new state, and a message when the action was refused (state
|
|
97
|
+
unchanged) or stopped short (a resize that stops at its edge). */
|
|
98
|
+
export interface TbResult {
|
|
99
|
+
state: TbState;
|
|
100
|
+
error?: string;
|
|
101
|
+
}
|
|
102
|
+
/** Splits a task as the app's add(): its estimate spread evenly over the
|
|
103
|
+
assignee's available days, as untimed parts. */
|
|
104
|
+
export declare const ensureSplit: (state: TbState, context: TbContext, taskId: number) => TbState;
|
|
105
|
+
/**
|
|
106
|
+
* The task's own timeboxes on a day a range would join, and the union with
|
|
107
|
+
* them; a timebox the union reaches joins too.
|
|
108
|
+
*/
|
|
109
|
+
export declare const mergeTargets: (state: TbState, taskId: number, date: DateKey, range: TimeRange, exceptPartId?: string) => {
|
|
110
|
+
parts: TbPart[];
|
|
111
|
+
union: TimeRange;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Joins the task's touching or overlapping timeboxes on a day into one, the
|
|
115
|
+
* union of their ranges. The run keeps keepPartId when it is in it, else its
|
|
116
|
+
* earliest timebox. The day's total does not change: the untimed part is
|
|
117
|
+
* derived again (minutes an overlap loses go back to it).
|
|
118
|
+
*/
|
|
119
|
+
export declare const mergeTimeboxes: (state: TbState, taskId: number, date: DateKey, keepPartId?: string) => TbState;
|
|
120
|
+
export interface DayValueRange {
|
|
121
|
+
min: number;
|
|
122
|
+
max: number;
|
|
123
|
+
/** The last workday: its value follows from the others. */
|
|
124
|
+
locked: boolean;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* The bounds of a day's total (EstimationsSplitsDialog's maxEstimate):
|
|
128
|
+
* anything from 0 to the estimate less the days before. Timeboxes do not
|
|
129
|
+
* bound it; they are fitted to the new totals (fitTimeboxes).
|
|
130
|
+
*/
|
|
131
|
+
export declare const dayValueRange: (state: TbState, context: TbContext, taskId: number, date: DateKey) => DayValueRange;
|
|
132
|
+
/** The inline error for a day value, or null when it can be saved. */
|
|
133
|
+
export declare const dayValueError: (state: TbState, context: TbContext, taskId: number, date: DateKey, minutes: number) => string | null;
|
|
134
|
+
/**
|
|
135
|
+
* Fits a day's timeboxes into a new total. When the total still holds what
|
|
136
|
+
* is pinned, the timeboxes stay and the untimed part takes the rest.
|
|
137
|
+
* Otherwise the untimed part goes first, then the timeboxes from the latest
|
|
138
|
+
* start back: those no longer needed are deleted, the last one kept is
|
|
139
|
+
* shortened at its end (rounded down to 5 minutes, the leftover minutes
|
|
140
|
+
* untimed), and deleted too when that leaves it under the min gap.
|
|
141
|
+
*/
|
|
142
|
+
export declare const fitTimeboxes: (state: TbState, taskId: number, date: DateKey, total: number) => TbState;
|
|
143
|
+
/** The timeboxes an edit of a day's total would shorten or delete,
|
|
144
|
+
without saving it. */
|
|
145
|
+
export declare const previewDayValue: (state: TbState, context: TbContext, taskId: number, date: DateKey, minutes: number) => TimeboxChange[];
|
|
146
|
+
/** How many of the day's minutes a dragged row can still pin. */
|
|
147
|
+
export declare const draggableMinutes: (state: TbState, context: TbContext, taskId: number, date: DateKey) => number;
|
|
148
|
+
/**
|
|
149
|
+
* Where a dropped task lands: at the snapped drop time, as long as its
|
|
150
|
+
* untimed minutes for the day, cut at the next pinned timebox (the rest
|
|
151
|
+
* stays a suggestion) and at midnight. A task without an estimate gets an
|
|
152
|
+
* hour.
|
|
153
|
+
*/
|
|
154
|
+
export declare const planDrop: (state: TbState, context: TbContext, taskId: number, date: DateKey, dropAt: number) => {
|
|
155
|
+
start: number;
|
|
156
|
+
minutes: number;
|
|
157
|
+
} | {
|
|
158
|
+
error: string;
|
|
159
|
+
};
|
|
160
|
+
/** A timebox's new start: snapped, kept between its pinned neighbours and
|
|
161
|
+
inside the day. Events may overlap it. */
|
|
162
|
+
export declare const planMove: (state: TbState, partId: string, start: number) => number;
|
|
163
|
+
export type ResizePlan =
|
|
164
|
+
/** Inside the day's allocation: minutes move to or from the untimed part.
|
|
165
|
+
merges: the task's own timeboxes the new edge reaches; start and end
|
|
166
|
+
are then the union with them. */
|
|
167
|
+
{
|
|
168
|
+
kind: "free";
|
|
169
|
+
start: number;
|
|
170
|
+
end: number;
|
|
171
|
+
merges: TbPart[];
|
|
172
|
+
}
|
|
173
|
+
/** Past the allocation: confirm, then the day's total grows. */
|
|
174
|
+
| {
|
|
175
|
+
kind: "increase";
|
|
176
|
+
start: number;
|
|
177
|
+
end: number;
|
|
178
|
+
from: number;
|
|
179
|
+
to: number;
|
|
180
|
+
merges: TbPart[];
|
|
181
|
+
}
|
|
182
|
+
/** The edge stops here. */
|
|
183
|
+
| {
|
|
184
|
+
kind: "blocked";
|
|
185
|
+
start: number;
|
|
186
|
+
end: number;
|
|
187
|
+
reason: string;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* A resize: snapped, kept between pinned neighbours and inside the day, at
|
|
191
|
+
* least the min gap long. An edge that reaches one of the task's own
|
|
192
|
+
* timeboxes joins it: the plan is the union, and its growth is the union
|
|
193
|
+
* less both lengths. Growing past the day's allocation takes minutes
|
|
194
|
+
* from the following days, which a one-day task or the task's last day
|
|
195
|
+
* cannot.
|
|
196
|
+
*/
|
|
197
|
+
export declare const planResize: (state: TbState, context: TbContext, partId: string, start: number, end: number) => ResizePlan;
|
|
198
|
+
/** The confirm dialog's text for growing a day's allocation. */
|
|
199
|
+
export declare const increaseConfirmText: (task: TbTask, from: number, to: number) => string;
|
|
200
|
+
/** The confirm dialog's text for unsplitting a task. */
|
|
201
|
+
export declare const unsplitConfirmText: (state: TbState, task: TbTask) => string;
|
|
202
|
+
export declare const reduce: (state: TbState, context: TbContext, action: TbAction) => TbResult;
|
|
203
|
+
//# sourceMappingURL=reducer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reducer.d.ts","sourceRoot":"","sources":["../../../../src/presentation/timeboxes/reducer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,WAAW,CAAC;AAC1D,OAAO,EACL,OAAO,EAGP,OAAO,EACP,MAAM,EACN,UAAU,EACV,OAAO,EACP,MAAM,EACN,SAAS,EAiBV,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAsC,MAAM,QAAQ,CAAC;AAEvE,MAAM,MAAM,QAAQ;AAClB,sEAAsE;AACpE;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AACH,2CAA2C;GACzC;IACE,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CA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