@parallelworks/tandem-web 0.189.9 → 0.189.10

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.
@@ -2120,7 +2120,6 @@ var e = {
2120
2120
  share: "{percent} of {count}",
2121
2121
  doneOf: "{done} of {total} done",
2122
2122
  showing: "{count, plural, one {Showing # issue} other {Showing # issues}}",
2123
- showAll: "Show all issues",
2124
2123
  cycles: "Cycles",
2125
2124
  noCycle: "No cycle",
2126
2125
  cycle: "Cycle {number}",
@@ -2120,7 +2120,6 @@ var e = {
2120
2120
  share: "{percent} de {count}",
2121
2121
  doneOf: "{done} de {total} hechas",
2122
2122
  showing: "{count, plural, one {Mostrando # incidencia} other {Mostrando # incidencias}}",
2123
- showAll: "Mostrar todas las incidencias",
2124
2123
  cycles: "Ciclos",
2125
2124
  noCycle: "Sin ciclo",
2126
2125
  cycle: "Ciclo {number}",
@@ -2120,7 +2120,6 @@ var e = {
2120
2120
  share: "{count} 件中 {percent}",
2121
2121
  doneOf: "{total} 件中 {done} 件完了",
2122
2122
  showing: "{count} 件の課題を表示中",
2123
- showAll: "すべての課題を表示",
2124
2123
  cycles: "サイクル",
2125
2124
  noCycle: "サイクルなし",
2126
2125
  cycle: "サイクル {number}",
@@ -2120,7 +2120,6 @@ var e = {
2120
2120
  share: "{count}개 중 {percent}",
2121
2121
  doneOf: "{total}개 중 {done}개 완료",
2122
2122
  showing: "이슈 {count}개 표시 중",
2123
- showAll: "모든 이슈 보기",
2124
2123
  cycles: "사이클",
2125
2124
  noCycle: "사이클 없음",
2126
2125
  cycle: "사이클 {number}",
@@ -2120,7 +2120,6 @@ var e = {
2120
2120
  share: "{count} 个中的 {percent}",
2121
2121
  doneOf: "{total} 个中已完成 {done} 个",
2122
2122
  showing: "显示 {count} 个问题",
2123
- showAll: "显示所有问题",
2124
2123
  cycles: "周期",
2125
2124
  noCycle: "无周期",
2126
2125
  cycle: "周期 {number}",
@@ -4,9 +4,10 @@ import { CycleIcon as n, PriorityIcon as r, ProjectIcon as i, UserIcon as a, use
4
4
  import { Avatar as s, Tabs as c } from "@parallelworks/ui";
5
5
  import { useLocale as l, useTranslations as u } from "use-intl";
6
6
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
7
+ import { ListFilterBar as m, useListFilters as h } from "@parallelworks/ui/list";
7
8
  // src/components/IssueBreakdown.tsx
8
- var m = "";
9
- function h(e, t) {
9
+ var g = "";
10
+ function _(e, t) {
10
11
  let n;
11
12
  switch (t) {
12
13
  case "assignees":
@@ -21,109 +22,147 @@ function h(e, t) {
21
22
  break;
22
23
  case "cycles": n = e.cycle ? [e.cycle.id] : [];
23
24
  }
24
- return n.length > 0 ? n : [m];
25
+ return n.length > 0 ? n : [g];
25
26
  }
26
- var g = [
27
+ var v = [
27
28
  1,
28
29
  2,
29
30
  3,
30
31
  4,
31
32
  0
32
33
  ];
33
- function _({ workspace: _, issues: b, tabs: x, tab: S, onTabChange: C, focus: w, onFocus: T }) {
34
- let E = u("planning.issueBreakdown"), D = l(), O = o(), { nameOf: k, avatarOf: A } = t(_), j = new Intl.NumberFormat(D, {
35
- style: "percent",
36
- maximumFractionDigits: 0
37
- }), M = /* @__PURE__ */ new Map();
38
- for (let e of b) {
39
- if (e.status.category === "canceled") continue;
40
- let t = +(e.status.category === "completed");
41
- for (let n of h(e, S)) {
42
- let r = M.get(n);
43
- r || (r = {
44
- key: n,
45
- ...N(e, n),
46
- done: 0,
47
- total: 0
48
- }, M.set(n, r)), r.done += t, r.total++;
49
- }
34
+ function y(e, t, n) {
35
+ for (let [r, i] of Object.entries(t)) if (r !== n && i.length !== 0 && !_(e, r).some((e) => i.includes(e))) return !1;
36
+ return !0;
37
+ }
38
+ var b = [
39
+ "assignees",
40
+ "labels",
41
+ "priority",
42
+ "projects",
43
+ "cycles"
44
+ ];
45
+ function x(e) {
46
+ let t = {};
47
+ if (typeof e != "string") return t;
48
+ for (let n of e.split(",")) {
49
+ let e = n.indexOf(":"), r = n.slice(0, e);
50
+ if (e < 0 || !b.includes(r)) continue;
51
+ let i = n.slice(e + 1), a = t[r] ?? [];
52
+ a.includes(i) || (t[r] = [...a, i]);
50
53
  }
51
- function N(t, o) {
52
- switch (S) {
54
+ return t;
55
+ }
56
+ function S(e) {
57
+ let t = b.flatMap((t) => (e[t] ?? []).map((e) => `${t}:${e}`));
58
+ return t.length > 0 ? t.join(",") : void 0;
59
+ }
60
+ var C = (e) => Object.values(e).reduce((e, t) => e + t.length, 0), w = (e) => e === "priority";
61
+ function T(e, t, n) {
62
+ let r = e[t] ?? [], i = r.includes(n) ? r.filter((e) => e !== n) : w(t) ? [...r, n] : [n], { [t]: a, ...o } = e;
63
+ return i.length > 0 ? {
64
+ ...o,
65
+ [t]: i
66
+ } : o;
67
+ }
68
+ function E(c) {
69
+ let l = u("planning.issueBreakdown"), d = o(), { nameOf: p, avatarOf: m } = t(c);
70
+ return (t, o, c) => {
71
+ switch (t) {
53
72
  case "assignees": {
54
- if (o === m) return {
55
- name: E("noAssignee"),
73
+ if (c === g) return {
74
+ name: l("noAssignee"),
56
75
  icon: /* @__PURE__ */ f(a, { className: "size-5 text-muted-foreground" })
57
76
  };
58
- let n = t.assignees.find((e) => `${e.kind}:${e.handle}` === o), r = n ? k(n.kind, n.handle) : o;
77
+ let t = o.assignees.find((e) => `${e.kind}:${e.handle}` === c), n = t ? p(t.kind, t.handle) : c;
59
78
  return {
60
- name: r,
61
- icon: n && /* @__PURE__ */ f(s, {
79
+ name: n,
80
+ icon: t && /* @__PURE__ */ f(s, {
62
81
  size: "xs",
63
- ...e(n.kind),
64
- name: r,
65
- src: A(n.kind, n.handle)
82
+ ...e(t.kind),
83
+ name: n,
84
+ src: m(t.kind, t.handle)
66
85
  })
67
86
  };
68
87
  }
69
88
  case "labels": {
70
- if (o === m) return {
71
- name: E("noLabel"),
72
- icon: /* @__PURE__ */ f(v, { color: "" })
89
+ if (c === g) return {
90
+ name: l("noLabel"),
91
+ icon: /* @__PURE__ */ f(N, { color: "" })
73
92
  };
74
- let e = t.labels.find((e) => e.id === o);
93
+ let e = o.labels.find((e) => e.id === c);
75
94
  return {
76
- name: e?.name ?? o,
77
- icon: /* @__PURE__ */ f(v, { color: e?.color ?? "" })
95
+ name: e?.name ?? c,
96
+ icon: /* @__PURE__ */ f(N, { color: e?.color ?? "" })
78
97
  };
79
98
  }
80
99
  case "priority": return {
81
- name: O[Number(o)] ?? o,
100
+ name: d[Number(c)] ?? c,
82
101
  icon: /* @__PURE__ */ f(r, {
83
- priority: Number(o),
102
+ priority: Number(c),
84
103
  className: "text-muted-foreground"
85
104
  })
86
105
  };
87
- case "projects": return o === m ? {
88
- name: E("noProject"),
106
+ case "projects": return c === g ? {
107
+ name: l("noProject"),
89
108
  icon: /* @__PURE__ */ f(i, { className: "text-muted-foreground" })
90
109
  } : {
91
- name: t.project?.name ?? o,
110
+ name: o.project?.name ?? c,
92
111
  icon: /* @__PURE__ */ f(i, { className: "text-muted-foreground" })
93
112
  };
94
113
  case "cycles": {
95
- let e = /* @__PURE__ */ f(n, { className: "text-muted-foreground" }), r = t.cycle;
96
- return o === m || !r ? {
97
- name: E("noCycle"),
114
+ let e = /* @__PURE__ */ f(n, { className: "text-muted-foreground" }), t = o.cycle;
115
+ return c === g || !t ? {
116
+ name: l("noCycle"),
98
117
  icon: e
99
118
  } : {
100
- name: r.name ? E("cycleNamed", {
101
- number: r.number,
102
- name: r.name
103
- }) : E("cycle", { number: r.number }),
119
+ name: t.name ? l("cycleNamed", {
120
+ number: t.number,
121
+ name: t.name
122
+ }) : l("cycle", { number: t.number }),
104
123
  icon: e
105
124
  };
106
125
  }
107
126
  }
127
+ };
128
+ }
129
+ function D({ workspace: e, issues: t, tabs: n, tab: r, onTabChange: i, focus: a, onFocus: o }) {
130
+ let s = u("planning.issueBreakdown"), m = l(), h = E(e), b = new Intl.NumberFormat(m, {
131
+ style: "percent",
132
+ maximumFractionDigits: 0
133
+ }), x = a?.[r] ?? [], S = /* @__PURE__ */ new Map();
134
+ for (let e of t) {
135
+ if (e.status.category === "canceled") continue;
136
+ let t = _(e, r), n = !a || y(e, a, r);
137
+ for (let i of t) {
138
+ if (!n && !x.includes(i)) continue;
139
+ let t = S.get(i);
140
+ t || (t = {
141
+ key: i,
142
+ ...h(r, e, i),
143
+ done: 0,
144
+ total: 0
145
+ }, S.set(i, t)), n && (t.done += +(e.status.category === "completed"), t.total++);
146
+ }
108
147
  }
109
- let P = [...M.values()].sort((e, t) => S === "priority" ? g.indexOf(Number(e.key)) - g.indexOf(Number(t.key)) : S === "cycles" && e.key !== m && t.key !== m ? e.name.localeCompare(t.name, D, { numeric: !0 }) : e.key === m == (t.key === m) ? t.total - e.total || e.name.localeCompare(t.name, D) : e.key === m ? -1 : 1);
110
- return P.length === 0 ? /* @__PURE__ */ f("p", {
148
+ let w = [...S.values()].sort((e, t) => r === "priority" ? v.indexOf(Number(e.key)) - v.indexOf(Number(t.key)) : r === "cycles" && e.key !== g && t.key !== g ? e.name.localeCompare(t.name, m, { numeric: !0 }) : e.key === g == (t.key === g) ? t.total - e.total || e.name.localeCompare(t.name, m) : e.key === g ? -1 : 1);
149
+ return w.length === 0 && (!a || C(a) === 0) ? /* @__PURE__ */ f("p", {
111
150
  className: "rounded-lg border border-border px-4 py-5 text-sm text-muted-foreground",
112
- children: E("empty")
151
+ children: s("empty")
113
152
  }) : /* @__PURE__ */ p("div", { children: [/* @__PURE__ */ f(c, {
114
- label: E("label"),
153
+ label: s("label"),
115
154
  variant: "line",
116
155
  size: "sm",
117
- items: x.map((e) => ({
156
+ items: n.map((e) => ({
118
157
  value: e,
119
- label: E(e)
158
+ label: s(e)
120
159
  })),
121
- value: S,
122
- onValueChange: C
160
+ value: r,
161
+ onValueChange: i
123
162
  }), /* @__PURE__ */ f("ul", {
124
163
  className: "mt-3 space-y-0.5",
125
- children: P.map((e) => {
126
- let t = e.total ? e.done / e.total : 0, n = w?.tab === S && w.key === e.key, r = /* @__PURE__ */ p(d, { children: [
164
+ children: w.map((e) => {
165
+ let t = e.total ? e.done / e.total : 0, n = x.includes(e.key), i = /* @__PURE__ */ p(d, { children: [
127
166
  /* @__PURE__ */ f("span", {
128
167
  className: "flex size-5 shrink-0 items-center justify-center",
129
168
  children: e.icon
@@ -132,36 +171,83 @@ function _({ workspace: _, issues: b, tabs: x, tab: S, onTabChange: C, focus: w,
132
171
  className: "min-w-0 flex-1 truncate",
133
172
  children: e.name
134
173
  }),
135
- /* @__PURE__ */ f(y, { share: t }),
174
+ /* @__PURE__ */ f(P, { share: t }),
136
175
  /* @__PURE__ */ f("span", {
137
176
  className: "min-w-16 shrink-0 text-right text-xs whitespace-nowrap text-muted-foreground tabular-nums",
138
- title: E("doneOf", {
177
+ title: s("doneOf", {
139
178
  done: e.done,
140
179
  total: e.total
141
180
  }),
142
- children: E("share", {
143
- percent: j.format(t),
181
+ children: s("share", {
182
+ percent: b.format(t),
144
183
  count: e.total
145
184
  })
146
185
  })
147
- ] }), i = "flex h-9 w-full items-center gap-2.5 rounded-md px-2 text-left text-sm";
148
- return /* @__PURE__ */ f("li", { children: T ? /* @__PURE__ */ f("button", {
186
+ ] }), c = "flex h-9 w-full items-center gap-2.5 rounded-md px-2 text-left text-sm";
187
+ return /* @__PURE__ */ f("li", { children: o ? /* @__PURE__ */ f("button", {
149
188
  type: "button",
150
189
  "aria-pressed": n,
151
- onClick: () => T(n ? null : {
152
- tab: S,
153
- key: e.key
154
- }),
155
- className: `${i} transition-colors hover:bg-muted ${n ? "bg-muted" : ""}`,
156
- children: r
190
+ onClick: () => o(T(a ?? {}, r, e.key)),
191
+ className: `${c} transition-colors hover:bg-muted ${n ? "bg-muted" : ""}`,
192
+ children: i
157
193
  }) : /* @__PURE__ */ f("div", {
158
- className: i,
159
- children: r
194
+ className: c,
195
+ children: i
160
196
  }) }, e.key);
161
197
  })
162
198
  })] });
163
199
  }
164
- function v({ color: e }) {
200
+ var O = {
201
+ assignees: "assignee",
202
+ labels: "label",
203
+ priority: "priority",
204
+ projects: "project",
205
+ cycles: "cycle"
206
+ }, k = ":none", A = (e) => e === g ? k : e, j = (e) => e === k ? g : e;
207
+ function M({ workspace: e, issues: t, tabs: n, focus: r, onFocus: i, className: a }) {
208
+ let o = u("planning.issueBreakdown"), s = u("issueFilters"), c = E(e), l = n.map((e) => {
209
+ let n = /* @__PURE__ */ new Map();
210
+ for (let r of t) for (let t of _(r, e)) if (!n.has(t)) {
211
+ let { name: i, icon: a } = c(e, r, t);
212
+ n.set(t, {
213
+ value: A(t),
214
+ label: i,
215
+ icon: a
216
+ });
217
+ }
218
+ return {
219
+ key: e,
220
+ label: s(O[e]),
221
+ kind: "enum",
222
+ operators: ["is"],
223
+ multiple: w(e),
224
+ options: [...n.values()]
225
+ };
226
+ }), d = h({
227
+ storageKey: "tandem:issueBreakdown",
228
+ fields: l,
229
+ remember: !1,
230
+ store: {
231
+ value: Object.entries(r).map(([e, t]) => ({
232
+ field: e,
233
+ op: "is",
234
+ values: t.map(A)
235
+ })),
236
+ onChange: (e) => i(Object.fromEntries(e.filter((e) => e.values.length > 0).map((e) => [e.field, e.values.map(j)])))
237
+ }
238
+ }), p = t.filter((e) => y(e, r)).length;
239
+ return C(r) === 0 ? null : /* @__PURE__ */ f(m, {
240
+ filters: d,
241
+ label: o("label"),
242
+ className: a,
243
+ trailing: /* @__PURE__ */ f("span", {
244
+ className: "text-xs whitespace-nowrap text-muted-foreground",
245
+ role: "status",
246
+ children: o("showing", { count: p })
247
+ })
248
+ });
249
+ }
250
+ function N({ color: e }) {
165
251
  return /* @__PURE__ */ f("span", {
166
252
  className: "size-2.5 rounded-full border border-border",
167
253
  style: e ? {
@@ -170,7 +256,7 @@ function v({ color: e }) {
170
256
  } : void 0
171
257
  });
172
258
  }
173
- function y({ share: e }) {
259
+ function P({ share: e }) {
174
260
  let t = 2 * Math.PI * 6;
175
261
  return e >= 1 ? /* @__PURE__ */ p("svg", {
176
262
  viewBox: "0 0 16 16",
@@ -212,4 +298,4 @@ function y({ share: e }) {
212
298
  })]
213
299
  });
214
300
  }
215
- export { _ as IssueBreakdown, h as breakdownKeys };
301
+ export { M as BreakdownFilterBar, D as IssueBreakdown, C as breakdownCount, _ as breakdownKeys, S as formatBreakdown, y as inBreakdown, x as parseBreakdown };
package/lib/glossary.js CHANGED
@@ -31,37 +31,50 @@ function c(e) {
31
31
  }
32
32
  return t;
33
33
  }
34
- function l(e, n, r = !1) {
35
- let a = [], s = /* @__PURE__ */ new Set(), l = c(n), u = 0;
36
- for (; u < e.length;) {
37
- if (u > 0 && t(e[u - 1]) || !t(e[u])) {
38
- u++;
34
+ var l = /\s/;
35
+ function u(e, t, n) {
36
+ let r = t, i = n;
37
+ for (; r > 0 && !l.test(e[r - 1] ?? "");) r--;
38
+ for (; i < e.length && !l.test(e[i] ?? "");) i++;
39
+ let a = (e.slice(r, t) + e.slice(n, i)).replace(/[.,;:!?)\]}"'’”]+$/u, "");
40
+ return /[/<>=?]/.test(a);
41
+ }
42
+ function d(e, n, r = !1) {
43
+ let a = [], s = /* @__PURE__ */ new Set(), l = c(n), d = 0;
44
+ for (; d < e.length;) {
45
+ if (d > 0 && t(e[d - 1]) || !t(e[d])) {
46
+ d++;
47
+ continue;
48
+ }
49
+ let n = o(e, d), c = l.get(n.toLowerCase());
50
+ if (!c) {
51
+ d += n.length;
39
52
  continue;
40
53
  }
41
- let n = o(e, u), c = 0;
42
- for (let t of l.get(n.toLowerCase()) ?? []) {
43
- let n = i(e, u, t.text);
44
- if (n !== 0) {
54
+ let f = 0;
55
+ for (let t of c) {
56
+ let n = i(e, d, t.text);
57
+ if (!(n === 0 || u(e, d, d + n))) {
45
58
  (r || !s.has(t.id)) && (s.add(t.id), a.push({
46
- from: u,
47
- to: u + n,
59
+ from: d,
60
+ to: d + n,
48
61
  id: t.id
49
- })), c = n;
62
+ })), f = n;
50
63
  break;
51
64
  }
52
65
  }
53
- u += c > 0 ? c : n.length;
66
+ d += f > 0 ? f : n.length;
54
67
  }
55
68
  return a;
56
69
  }
57
- var u = 4;
58
- function d(e, t) {
59
- return e.filter((e) => e.key !== t && !e.template && e.title.trim().length >= u).map((e) => ({
70
+ var f = 4;
71
+ function p(e, t) {
72
+ return e.filter((e) => e.key !== t && !e.template && e.title.trim().length >= f).map((e) => ({
60
73
  text: e.title.trim(),
61
74
  id: `doc:${e.key}`
62
75
  })).sort((e, t) => t.text.length - e.text.length);
63
76
  }
64
- var f = (() => {
77
+ var m = (() => {
65
78
  let e = [], t = /* @__PURE__ */ new Set();
66
79
  return {
67
80
  forms: () => e,
@@ -76,18 +89,18 @@ var f = (() => {
76
89
  }
77
90
  };
78
91
  })();
79
- function p(e) {
92
+ function h(e) {
80
93
  return e.trim().toLowerCase().replace(/[^\p{L}\p{N}\s-]/gu, "").replace(/\s+/g, "-");
81
94
  }
82
- function m(e) {
95
+ function g(e) {
83
96
  return e.replace(/!?\[([^\]]*)\]\([^)]*\)/g, "$1").replace(/(\*\*|__|~~|`)(.+?)\1/g, "$2").replace(/(^|[^\w*])[*_]([^*_]+)[*_](?=[^\w*]|$)/g, "$1$2").trim();
84
97
  }
85
- function h(e) {
98
+ function _(e) {
86
99
  let t = [], n = "";
87
100
  for (let r of e.split("\n")) {
88
101
  let e = /^(`{3,}|~{3,})/.exec(r)?.[1];
89
102
  e && (!n || e.startsWith(n)) && (n = n ? "" : e);
90
- let i = n ? null : /^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(r), a = i?.[2] ? m(i[2]) : "";
103
+ let i = n ? null : /^(#{1,6})\s+(.+?)\s*#*\s*$/.exec(r), a = i?.[2] ? g(i[2]) : "";
91
104
  i?.[1] && a && t.push({
92
105
  level: i[1].length,
93
106
  text: a
@@ -95,4 +108,4 @@ function h(e) {
95
108
  }
96
109
  return t;
97
110
  }
98
- export { d as docForms, a as formsOf, f as glossary, p as headingAnchor, h as headings, l as mentions, m as plainHeading };
111
+ export { p as docForms, a as formsOf, m as glossary, h as headingAnchor, _ as headings, d as mentions, g as plainHeading };
package/lib/issueList.js CHANGED
@@ -42,7 +42,8 @@ function v(e) {
42
42
  "type",
43
43
  "fields",
44
44
  "q",
45
- "saved"
45
+ "saved",
46
+ "breakdown"
46
47
  ]) {
47
48
  let r = _(e[n]);
48
49
  r && (t[n] = r);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parallelworks/tandem-web",
3
- "version": "0.189.9",
3
+ "version": "0.189.10",
4
4
  "description": "Tandem's pages, for a host app to render in its own",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",