daily-focus 2.0.0-dev.14 → 2.0.0-dev.15

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "daily-focus",
3
- "version": "2.0.0-dev.14",
3
+ "version": "2.0.0-dev.15",
4
4
  "description": "An interactive dashboard of what you should focus on today at work",
5
5
  "keywords": [
6
6
  "dashboard",
@@ -28,6 +28,7 @@
28
28
  "public/index.html",
29
29
  "public/style.css",
30
30
  "public/app.js",
31
+ "public/fonts/",
31
32
  "prompts/",
32
33
  "schema/",
33
34
  "tools/dfcal/build.sh",
@@ -66,5 +67,8 @@
66
67
  "happy-dom": "20.14.5",
67
68
  "preact": "10.29.8",
68
69
  "typescript": "7.0.2"
70
+ },
71
+ "allowScripts": {
72
+ "esbuild": true
69
73
  }
70
74
  }
package/public/app.js CHANGED
@@ -2640,7 +2640,11 @@ function ItemRow({ item, state: state2, ui: ui2, handlers: handlers2 }) {
2640
2640
  },
2641
2641
  el(
2642
2642
  "span",
2643
- { class: "item__mark" },
2643
+ // A ranked row's number stands in the margin where the source dot would be:
2644
+ // the stylesheet draws it off `data-rank` and hides the dot, since the
2645
+ // source is named in the meta line anyway and the rank is what this row
2646
+ // is for.
2647
+ { class: "item__mark", "data-rank": item.priority !== void 0 && item.status === "open" ? String(item.priority) : void 0 },
2644
2648
  el("span", {
2645
2649
  class: "item__dot",
2646
2650
  style: `background:${sourceColor(item.source)}`,
@@ -2666,9 +2670,6 @@ function renderMeta(item, state2, now) {
2666
2670
  pills.push(el("span", { class: cls }, text));
2667
2671
  said.add(text.trim().toLowerCase());
2668
2672
  };
2669
- if (item.priority !== void 0 && item.status === "open") {
2670
- pill("pill pill--priority", `#${item.priority}`);
2671
- }
2672
2673
  for (const [cls, text] of rowPillTexts(item, state2)) pill(cls, text);
2673
2674
  if (item.advancesObjective) {
2674
2675
  pill("pill pill--objective", "objective");
@@ -4961,6 +4962,11 @@ function SettingsView({ state: state2, ui: ui2, handlers: handlers2 }) {
4961
4962
  }, []);
4962
4963
  const page = ui2.settings.value;
4963
4964
  const draft = ui2.settingsDraft.value;
4965
+ const sections = [
4966
+ { id: "objective", title: "Your objective" },
4967
+ { id: "sources", title: "Where the agent looks" },
4968
+ ...page?.groups ?? []
4969
+ ];
4964
4970
  return el(
4965
4971
  "div",
4966
4972
  { class: "settings" },
@@ -4970,6 +4976,7 @@ function SettingsView({ state: state2, ui: ui2, handlers: handlers2 }) {
4970
4976
  el("h2", { class: "settings__title" }, "Settings"),
4971
4977
  el("button", { type: "button", class: "button", onClick: () => handlers2.closeSettings() }, `Back to ${VIEW_NAME[ui2.settingsReturn.value]}`)
4972
4978
  ),
4979
+ k(SectionIndex, { sections }),
4973
4980
  page?.error ? el("p", { class: "settings__problem", role: "alert" }, page.error) : null,
4974
4981
  objectiveCard(state2, ui2, handlers2),
4975
4982
  sourcesCard(state2, ui2, handlers2),
@@ -4994,6 +5001,29 @@ function SettingsView({ state: state2, ui: ui2, handlers: handlers2 }) {
4994
5001
  saveBar(ui2, handlers2)
4995
5002
  );
4996
5003
  }
5004
+ function SectionIndex({ sections }) {
5005
+ const [current, setCurrent] = d2(sections[0]?.id ?? null);
5006
+ h2(() => {
5007
+ const look = () => {
5008
+ let seen = sections[0]?.id ?? null;
5009
+ for (const section2 of sections) {
5010
+ const card = document.getElementById(`settings-${section2.id}`);
5011
+ if (card && card.getBoundingClientRect().top <= 120) seen = section2.id;
5012
+ }
5013
+ setCurrent(seen);
5014
+ };
5015
+ look();
5016
+ window.addEventListener("scroll", look, { passive: true });
5017
+ return () => window.removeEventListener("scroll", look);
5018
+ }, [sections.map((section2) => section2.id).join(" ")]);
5019
+ return el(
5020
+ "nav",
5021
+ { class: "settings__nav", "aria-label": "Settings sections" },
5022
+ sections.map(
5023
+ (section2) => el("a", { key: section2.id, href: `#settings-${section2.id}`, "aria-current": section2.id === current ? "true" : void 0 }, section2.title)
5024
+ )
5025
+ );
5026
+ }
4997
5027
  function objectiveCard(state2, ui2, handlers2) {
4998
5028
  const focus = state2.focus;
4999
5029
  return el(
@@ -5122,6 +5152,7 @@ function shownValue(setting, draft) {
5122
5152
  if (draft.has(setting.key)) return draft.get(setting.key) ?? "";
5123
5153
  return setting.source === "default" ? "" : setting.value ?? "";
5124
5154
  }
5155
+ var SEGMENTS = 4;
5125
5156
  function flagValue(raw) {
5126
5157
  if (raw === "") return "";
5127
5158
  return ["off", "false", "0", "no"].includes(raw.trim().toLowerCase()) ? "off" : "on";
@@ -5138,7 +5169,30 @@ function settingField(setting, draft, handlers2) {
5138
5169
  if (setting.kind === "choice" || setting.kind === "flag") {
5139
5170
  const choices = setting.kind === "flag" ? [{ value: "on", label: "On" }, { value: "off", label: "Off" }] : setting.choices ?? [];
5140
5171
  const current = setting.kind === "flag" ? flagValue(value) : value;
5141
- input = el(
5172
+ const fallback = choices.find((choice) => choice.label.toLowerCase() === setting.fallback.toLowerCase());
5173
+ input = choices.length <= SEGMENTS && fallback ? el(
5174
+ "div",
5175
+ { class: "segmented", id, role: "radiogroup", "aria-label": setting.label, "aria-disabled": String(locked) },
5176
+ choices.map((choice) => {
5177
+ const isDefault = choice.value === fallback.value;
5178
+ const checked = current === "" ? isDefault : current === choice.value;
5179
+ return el(
5180
+ "button",
5181
+ {
5182
+ type: "button",
5183
+ key: choice.value,
5184
+ role: "radio",
5185
+ class: "segmented__option",
5186
+ "aria-checked": String(checked),
5187
+ disabled: locked,
5188
+ title: isDefault ? "The default" : void 0,
5189
+ onClick: () => handlers2.editSetting(setting.key, isDefault ? null : choice.value)
5190
+ },
5191
+ choice.label,
5192
+ checked && current === "" ? el("small", null, "default") : null
5193
+ );
5194
+ })
5195
+ ) : el(
5142
5196
  "select",
5143
5197
  { class: "field__input", id, disabled: locked, value: current, onChange },
5144
5198
  el("option", { value: "" }, `Default: ${setting.fallback}`),
@@ -5291,7 +5345,10 @@ function FirstBriefCard({ state: state2, handlers: handlers2 }) {
5291
5345
  // client/today.ts
5292
5346
  function TodayView({ state: state2, ui: ui2, handlers: handlers2 }) {
5293
5347
  if (state2.setup?.needed) return [k(FirstBriefCard, { state: state2, handlers: handlers2 })];
5294
- return [renderObjective(state2, handlers2), renderStats(state2), renderHeadline(state2), renderSections(state2, ui2, handlers2)];
5348
+ return [
5349
+ el("div", { class: "today__masthead" }, renderObjective(state2, handlers2), renderStats(state2), renderHeadline(state2)),
5350
+ renderSections(state2, ui2, handlers2)
5351
+ ];
5295
5352
  }
5296
5353
  function renderObjective(state2, handlers2 = null) {
5297
5354
  const focus = state2.focus;
@@ -5413,8 +5470,9 @@ function App({ ui: ui2, handlers: handlers2 }) {
5413
5470
  if (current?.onboarding) return [k(OnboardingView, { state: current, ui: ui2, handlers: handlers2 }), k(Toast, { ui: ui2, handlers: handlers2 })];
5414
5471
  return [
5415
5472
  el("a", { class: "skip-link", href: "#main" }, "Skip to content"),
5416
- k(Header, { state: current, ui: ui2, handlers: handlers2 }),
5417
- k(Tabs, { state: current, ui: ui2, handlers: handlers2 }),
5473
+ // The band: the masthead's navy runs behind both, and on Today on behind
5474
+ // the objective below (see `.band` in the stylesheet).
5475
+ el("div", { class: "band" }, k(Header, { state: current, ui: ui2, handlers: handlers2 }), k(Tabs, { state: current, ui: ui2, handlers: handlers2 })),
5418
5476
  el("div", { id: "banners", class: "banners" }, current ? renderBanners(current, ui2, handlers2) : null),
5419
5477
  el(
5420
5478
  "main",
@@ -0,0 +1,93 @@
1
+ Copyright © 2017 IBM Corp. with Reserved Font Name "Plex"
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+
5
+ This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.