@dsh-workbench/shared 0.1.4 → 0.1.5

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.
@@ -6,11 +6,11 @@ export function CardHead({ t, title, meta, refreshing, onRefresh, gear, gearOpen
6
6
  return (h("header", { className: "wb-cardHead" },
7
7
  h("h2", { className: "wb-cardTitle" }, title),
8
8
  meta === undefined ? null : h("span", { className: "wb-cardMeta" }, meta),
9
- platformHref === undefined || platform === undefined ? null : (h(Tooltip, { label: platformTitle ?? platform },
9
+ platformHref === undefined || platform === undefined ? null : (h(Tooltip, { side: "bottom", align: "end", gap: 6, portal: true, label: platformTitle ?? platform },
10
10
  h("a", { className: "wb-iconButton wb-cardOpen", href: platformHref, target: "_blank", rel: "noreferrer noopener", "aria-label": platform },
11
11
  h(IconRightUpOutlineRegular, { size: 14 })))),
12
- h(Tooltip, { label: refreshLabel },
12
+ h(Tooltip, { side: "bottom", align: "end", gap: 6, portal: true, label: refreshLabel },
13
13
  h(Button, { type: "button", size: "sm", variant: "ghost", className: `wb-cardRefresh${refreshing ? ' wb-spinning' : ''}`, "aria-label": refreshLabel, disabled: refreshing, icon: h(IconRefreshOutlineRegular, { size: 14 }), onClick: onRefresh })),
14
- gear === undefined || onToggleGear === undefined ? null : (h(Tooltip, { label: gear },
14
+ gear === undefined || onToggleGear === undefined ? null : (h(Tooltip, { side: "bottom", align: "end", gap: 6, portal: true, label: gear },
15
15
  h(Button, { type: "button", size: "sm", variant: "ghost", className: `wb-cardGear${gearOpen === true ? ' wb-iconButtonActive' : ''}`, "aria-label": gear, "aria-expanded": gearOpen === true, icon: h(IconSettingsOutlineRegular, { size: 15 }), onClick: onToggleGear })))));
16
16
  }
package/dist/lib/ui.d.ts CHANGED
@@ -2,10 +2,4 @@ export declare function cx(...parts: Array<string | false | null | undefined>):
2
2
  export type TimeTranslate = (key: string, params?: Record<string, unknown>) => string;
3
3
  export declare function relativeTime(epochMs: number, t: TimeTranslate): string;
4
4
  export declare function shortenPath(path: unknown): string;
5
- export declare const LINK_BUTTON_STYLE: {
6
- readonly display: "inline-flex";
7
- readonly alignItems: "center";
8
- readonly gap: "var(--wb-gap-xs)";
9
- readonly textDecoration: "none";
10
- };
11
5
  export declare function parseLocalTimestamp(text: string | null | undefined): number;
package/dist/lib/ui.js CHANGED
@@ -22,12 +22,6 @@ export function shortenPath(path) {
22
22
  const hit = path.match(/^\/Users\/[^/]+/);
23
23
  return hit === null ? path : path.replace(hit[0], '~');
24
24
  }
25
- export const LINK_BUTTON_STYLE = {
26
- display: 'inline-flex',
27
- alignItems: 'center',
28
- gap: 'var(--wb-gap-xs)',
29
- textDecoration: 'none',
30
- };
31
25
  const LOCAL_TIMESTAMP = /^(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2}):(\d{2})$/;
32
26
  export function parseLocalTimestamp(text) {
33
27
  const raw = String(text ?? '').trim();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-workbench/shared",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "工作台与模块共享的纯代码与契约类型:类型、纯逻辑、哑组件、平台解析。宿主侧的东西从 /host 进(不影响浏览器产物)。",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -43,7 +43,7 @@ export function CardHead({
43
43
  <h2 className="wb-cardTitle">{title}</h2>
44
44
  {meta === undefined ? null : <span className="wb-cardMeta">{meta}</span>}
45
45
  {platformHref === undefined || platform === undefined ? null : (
46
- <Tooltip label={platformTitle ?? platform}>
46
+ <Tooltip side="bottom" align="end" gap={6} portal label={platformTitle ?? platform}>
47
47
  <a
48
48
  className="wb-iconButton wb-cardOpen"
49
49
  href={platformHref}
@@ -55,7 +55,7 @@ export function CardHead({
55
55
  </a>
56
56
  </Tooltip>
57
57
  )}
58
- <Tooltip label={refreshLabel}>
58
+ <Tooltip side="bottom" align="end" gap={6} portal label={refreshLabel}>
59
59
  <Button
60
60
  type="button"
61
61
  size="sm"
@@ -68,7 +68,7 @@ export function CardHead({
68
68
  />
69
69
  </Tooltip>
70
70
  {gear === undefined || onToggleGear === undefined ? null : (
71
- <Tooltip label={gear}>
71
+ <Tooltip side="bottom" align="end" gap={6} portal label={gear}>
72
72
  <Button
73
73
  type="button"
74
74
  size="sm"
package/src/lib/ui.ts CHANGED
@@ -22,13 +22,6 @@ export function shortenPath(path: unknown): string {
22
22
  return hit === null ? path : path.replace(hit[0], '~');
23
23
  }
24
24
 
25
- export const LINK_BUTTON_STYLE = {
26
- display: 'inline-flex',
27
- alignItems: 'center',
28
- gap: 'var(--wb-gap-xs)',
29
- textDecoration: 'none',
30
- } as const;
31
-
32
25
  const LOCAL_TIMESTAMP = /^(\d{4})-(\d{2})-(\d{2})[ T](\d{2}):(\d{2}):(\d{2})$/;
33
26
 
34
27
  export function parseLocalTimestamp(text: string | null | undefined): number {