@celljs/ta-dash 4.42.0 → 4.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/host/index.mjs CHANGED
@@ -653,6 +653,13 @@ var TA_WEB_SETTINGS = [
653
653
  what: "Conversations not updated for these days are archived (out of the list, found by search); 0 for none.",
654
654
  title: words("Archive old conversations", "归档旧对话", "歸檔舊對話", "古い会話をアーカイブ")
655
655
  },
656
+ {
657
+ key: "clipboardLinks",
658
+ type: "boolean",
659
+ default: true,
660
+ what: "Links of Ta in what the user copied are offered as Ta comes back to the front, and in what they paste, with Open.",
661
+ title: words("Spot links of Ta you copy", "识别复制的 Ta 链接", "識別複製的 Ta 連結", "コピーした Ta のリンクを見つける")
662
+ },
656
663
  {
657
664
  key: "recentShots",
658
665
  type: "boolean",
@@ -3070,6 +3077,23 @@ var TaWorkMark;
3070
3077
  return TaWorkMark2.COMMENTED.includes(language) ? `<!-- ta-work: ${work} -->` : `"work": "${work}"`;
3071
3078
  }
3072
3079
  TaWorkMark2.mark = mark;
3080
+ function unnamed(language, code) {
3081
+ if (!of(language, code)) {
3082
+ return code;
3083
+ }
3084
+ if (TaWorkMark2.COMMENTED.includes(language)) {
3085
+ return code.replace(TaWorkMark2.COMMENT, "").replace(/^\s*\n/, "");
3086
+ }
3087
+ const stripped = code.replace(/"work"\s*:\s*"work-[a-z0-9]{1,32}"\s*,\s*/, "");
3088
+ try {
3089
+ if (!of(language, stripped) && JSON.parse(stripped)) {
3090
+ return stripped;
3091
+ }
3092
+ } catch (_a) {}
3093
+ const value = JSON.parse(code);
3094
+ return JSON.stringify(Object.fromEntries(Object.entries(value).filter(([key]) => key !== "work")), null, 2);
3095
+ }
3096
+ TaWorkMark2.unnamed = unnamed;
3073
3097
  })(TaWorkMark || (TaWorkMark = {}));
3074
3098
  // ../ta-protocol/esm/common/work-point.js
3075
3099
  var TaWorkPoint;
@@ -3175,6 +3199,15 @@ var TaWorkTitle;
3175
3199
  }
3176
3200
  }
3177
3201
  TaWorkTitle2.of = of;
3202
+ function repeats(own, titled) {
3203
+ const plain = (text) => {
3204
+ var _a;
3205
+ return (_a = clean(text === null || text === undefined ? undefined : text.replace(/[*_`]+/g, ""))) === null || _a === undefined ? undefined : _a.toLowerCase();
3206
+ };
3207
+ const shown = plain(titled);
3208
+ return shown !== undefined && plain(own) === shown;
3209
+ }
3210
+ TaWorkTitle2.repeats = repeats;
3178
3211
  function clean(text) {
3179
3212
  const line = text === null || text === undefined ? undefined : text.trim().replace(/\s+/g, " ");
3180
3213
  return line ? line.slice(0, 60) : undefined;
@@ -3191,6 +3224,29 @@ ${fence}`;
3191
3224
  }
3192
3225
  TaWorkBlock2.fenced = fenced;
3193
3226
  })(TaWorkBlock || (TaWorkBlock = {}));
3227
+ var TaWorkFile;
3228
+ (function(TaWorkFile2) {
3229
+ const TYPE = /^text\/vnd\.([a-z0-9-]+)\+markdown$/;
3230
+ function type(language2) {
3231
+ return `text/vnd.${language2}+markdown`;
3232
+ }
3233
+ TaWorkFile2.type = type;
3234
+ function language(type2) {
3235
+ var _a;
3236
+ const found = (_a = TYPE.exec(type2)) === null || _a === undefined ? undefined : _a[1];
3237
+ return found && TaWorkTitle.is(found) ? found : undefined;
3238
+ }
3239
+ TaWorkFile2.language = language;
3240
+ function name(title2) {
3241
+ const clean = Array.from(title2, (char) => char < " " || '\\/:*?"<>|'.includes(char) ? " " : char).join("").replace(/\s+/g, " ").trim().slice(0, 60);
3242
+ return `${clean || "work"}.md`;
3243
+ }
3244
+ TaWorkFile2.name = name;
3245
+ function title(name2) {
3246
+ return name2.replace(/\.md$/i, "");
3247
+ }
3248
+ TaWorkFile2.title = title;
3249
+ })(TaWorkFile || (TaWorkFile = {}));
3194
3250
  // ../ta-protocol/esm/common/workspace-protocol.js
3195
3251
  var TaWorkspaceServer = Symbol("TaWorkspaceServer");
3196
3252
  var TaTerminalServer = Symbol("TaTerminalServer");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@celljs/ta-dash",
3
- "version": "4.42.0",
3
+ "version": "4.43.0",
4
4
  "description": "A pi package for Ta: dashboards of replies whose numbers come from queries run on the user's computer, kept current, each showing the query behind it",
5
5
  "keywords": [
6
6
  "pi-package"
@@ -27,9 +27,9 @@
27
27
  "watch": "tsc -b -w --preserveWatchOutput"
28
28
  },
29
29
  "devDependencies": {
30
- "@celljs/core": "4.42.0",
31
- "@celljs/ta-protocol": "4.42.0",
32
- "@celljs/ta-web": "4.42.0",
30
+ "@celljs/core": "4.43.0",
31
+ "@celljs/ta-protocol": "4.43.0",
32
+ "@celljs/ta-web": "4.43.0",
33
33
  "@types/node": "^24.0.0",
34
34
  "@types/react": "^19.3.3"
35
35
  },
package/web/index.js CHANGED
@@ -21,6 +21,99 @@ var DashLimits;
21
21
  DashLimits.MIN_REFRESH_MS = 60000;
22
22
  })(DashLimits ||= {});
23
23
 
24
+ // ../ta-protocol/esm/common/work-title.js
25
+ var TA_WORK_BLOCKS = {
26
+ "ta-play": "Gamepad2",
27
+ "ta-plot": "ChartSpline",
28
+ "ta-3d": "Box",
29
+ "ta-glance": "LayoutDashboard",
30
+ "ta-doc": "FileText",
31
+ "ta-slides": "Presentation",
32
+ "ta-sheet": "Sheet",
33
+ "ta-dash": "Gauge",
34
+ "ta-motion": "Film"
35
+ };
36
+ var TaWorkTitle;
37
+ (function(TaWorkTitle2) {
38
+ function is(language) {
39
+ return Object.keys(TA_WORK_BLOCKS).includes(language);
40
+ }
41
+ TaWorkTitle2.is = is;
42
+ const MARKDOWN = ["ta-doc", "ta-slides"];
43
+ function of(language, code) {
44
+ var _a, _b;
45
+ if (MARKDOWN.includes(language)) {
46
+ const heading = (_a = /^ {0,3}#{1,6}\s+(.+?)\s*#*\s*$/m.exec(code.replace(/^ {0,3}(`{3,}|~{3,})[\s\S]*?^ {0,3}\1/gm, ""))) === null || _a === undefined ? undefined : _a[1];
47
+ return clean(heading === null || heading === undefined ? undefined : heading.replace(/[*_`]+/g, ""));
48
+ }
49
+ if (language === "ta-play") {
50
+ const title = (_b = /<title[^>]*>([^<]*)<\/title>/i.exec(code)) === null || _b === undefined ? undefined : _b[1];
51
+ return clean(title === null || title === undefined ? undefined : title.replace(/&(amp|lt|gt|quot|#39);/g, (_, name) => {
52
+ var _a2;
53
+ return (_a2 = { amp: "&", lt: "<", gt: ">", quot: '"', "#39": "'" }[name]) !== null && _a2 !== undefined ? _a2 : "";
54
+ }));
55
+ }
56
+ try {
57
+ const value = JSON.parse(code);
58
+ if (typeof (value === null || value === undefined ? undefined : value.title) === "string") {
59
+ return clean(value.title);
60
+ }
61
+ const first = Array.isArray(value === null || value === undefined ? undefined : value.blocks) ? value.blocks.find((block) => typeof (block === null || block === undefined ? undefined : block.title) === "string" || typeof (block === null || block === undefined ? undefined : block.question) === "string") : undefined;
62
+ return clean(typeof (first === null || first === undefined ? undefined : first.title) === "string" ? first.title : typeof (first === null || first === undefined ? undefined : first.question) === "string" ? first.question : undefined);
63
+ } catch (_c) {
64
+ return;
65
+ }
66
+ }
67
+ TaWorkTitle2.of = of;
68
+ function repeats(own, titled) {
69
+ const plain = (text) => {
70
+ var _a;
71
+ return (_a = clean(text === null || text === undefined ? undefined : text.replace(/[*_`]+/g, ""))) === null || _a === undefined ? undefined : _a.toLowerCase();
72
+ };
73
+ const shown = plain(titled);
74
+ return shown !== undefined && plain(own) === shown;
75
+ }
76
+ TaWorkTitle2.repeats = repeats;
77
+ function clean(text) {
78
+ const line = text === null || text === undefined ? undefined : text.trim().replace(/\s+/g, " ");
79
+ return line ? line.slice(0, 60) : undefined;
80
+ }
81
+ })(TaWorkTitle || (TaWorkTitle = {}));
82
+ var TaWorkBlock;
83
+ (function(TaWorkBlock2) {
84
+ function fenced(language, code) {
85
+ const longest = Math.max(2, ...[...code.matchAll(/`+/g)].map((run) => run[0].length));
86
+ const fence = "`".repeat(longest + 1);
87
+ return `${fence}${language}
88
+ ${code}
89
+ ${fence}`;
90
+ }
91
+ TaWorkBlock2.fenced = fenced;
92
+ })(TaWorkBlock || (TaWorkBlock = {}));
93
+ var TaWorkFile;
94
+ (function(TaWorkFile2) {
95
+ const TYPE = /^text\/vnd\.([a-z0-9-]+)\+markdown$/;
96
+ function type(language2) {
97
+ return `text/vnd.${language2}+markdown`;
98
+ }
99
+ TaWorkFile2.type = type;
100
+ function language(type2) {
101
+ var _a;
102
+ const found = (_a = TYPE.exec(type2)) === null || _a === undefined ? undefined : _a[1];
103
+ return found && TaWorkTitle.is(found) ? found : undefined;
104
+ }
105
+ TaWorkFile2.language = language;
106
+ function name(title2) {
107
+ const clean = Array.from(title2, (char) => char < " " || '\\/:*?"<>|'.includes(char) ? " " : char).join("").replace(/\s+/g, " ").trim().slice(0, 60);
108
+ return `${clean || "work"}.md`;
109
+ }
110
+ TaWorkFile2.name = name;
111
+ function title(name2) {
112
+ return name2.replace(/\.md$/i, "");
113
+ }
114
+ TaWorkFile2.title = title;
115
+ })(TaWorkFile || (TaWorkFile = {}));
116
+
24
117
  // web-src/dash-rows.ts
25
118
  var ROW_KEYS = ["rows", "data", "results", "result", "items", "records", "values"];
26
119
  function cell(value) {
@@ -909,7 +1002,7 @@ function dashView(pi) {
909
1002
  ref: card
910
1003
  }, /* @__PURE__ */ React.createElement("div", {
911
1004
  className: "tdash-head"
912
- }, /* @__PURE__ */ React.createElement("div", {
1005
+ }, !TaWorkTitle.repeats(title, props.titled) && /* @__PURE__ */ React.createElement("div", {
913
1006
  className: "tdash-title"
914
1007
  }, title), /* @__PURE__ */ React.createElement("div", {
915
1008
  className: "tdash-fresh"
@@ -940,7 +1033,7 @@ function dashView(pi) {
940
1033
  className: "tdash-ask-hint"
941
1034
  }, words.askHint), /* @__PURE__ */ React.createElement("button", {
942
1035
  type: "button",
943
- className: acting ? "tdash-allow ta-busy" : "tdash-allow",
1036
+ className: acting ? "ta-button ta-primary ta-busy" : "ta-button ta-primary",
944
1037
  disabled: busy,
945
1038
  onClick: () => void run(() => load("approve"))
946
1039
  }, words.allow)), /* @__PURE__ */ React.createElement("div", {
@@ -1033,10 +1126,6 @@ var STYLE = `
1033
1126
  .tdash-ask { margin-bottom: 10px; padding: 10px 12px; border-radius: 10px; background: var(--ta-raised); }
1034
1127
  .tdash-ask-title { font-weight: 600; margin-bottom: 6px; }
1035
1128
  .tdash-ask-hint { color: var(--ta-muted); font-size: calc(12px * var(--tdash-s)); margin: 6px 0 8px; }
1036
- .tdash-allow {
1037
- padding: 5px 14px; border: 0; border-radius: 8px; background: var(--ta-accent); color: #fff; font: inherit; cursor: pointer;
1038
- }
1039
- .tdash-allow:disabled { opacity: 0.6; }
1040
1129
  .tdash-query {
1041
1130
  margin: 4px 0 0; padding: 8px 10px; border-radius: 8px; background: var(--ta-card); color: var(--ta-body, var(--ta-text));
1042
1131
  font-family: var(--ta-mono, ui-monospace, monospace); font-size: calc(11.5px * var(--tdash-s)); line-height: 1.55;