@robert-stackflow/oneui 0.6.20 → 0.6.21

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.6.21
2
+
3
+ - Add Link with inherited typography, subtle content links, shared hover/focus states and disabled navigation. Export from the root and Link subpath.
4
+ - Add Markdown fontSize for reading preferences, with scaled prose and headings; default rendering remains unchanged.
5
+ - Keep Slider's accessible name stable when its current value changes; native range value announcements remain available.
6
+
1
7
  # 0.6.19
2
8
 
3
9
  - Add opt-in Combobox allowCustomValue input mode: preserve freely typed text on blur, Enter, and async loading or failure; only explicit option selection commits an option. Pass the selected option as the optional second onChange argument.
package/README.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  React 组件、应用外壳和两套可互换的主题。无 Electron、React Router、账户 API 或持久化存储依赖。
4
4
 
5
+ ## 内容链接与阅读字号(0.6.21)
6
+
7
+ `Link` 从根入口或 `@robert-stackflow/oneui/Link` 导入。默认使用主题链接色;`variant="subtle"` 继承周围标题或正文的颜色与字体,统一 hover、键盘焦点和 disabled 行为,保留原生链接与新标签打开语义。应用无需单独定义标题链接样式。
8
+
9
+ `Markdown` 支持 `fontSize={18}`,正文与相对字号标题共同缩放;不传时保持默认 14 px。有限数值限制在 10–48 px,非有限数值沿用默认值。
10
+
5
11
  ## 可读前景色(0.6.16 候选)
6
12
 
7
13
  `--accent-ink` 用于文字、小图标、细标记和焦点;按钮实心填充仍使用 `--accent-fill` / `--accent`。极简主题的 ink 随前景色变化,蓝白主题使用相应模式的强调色;自定义强调色混入当前前景色后用于 ink,避免深色模式中的深灰标记或浅色模式中的白色标记不可见。可单独覆盖此变量。徽标、链接、步骤、菜单/单选标记、进度、图表、时间线及信息反馈复用这套颜色。
@@ -0,0 +1,8 @@
1
+ import type { ComponentPropsWithRef } from "react";
2
+ export type LinkProps = ComponentPropsWithRef<"a"> & {
3
+ /** Subtle links inherit their surrounding heading or text color. */
4
+ variant?: "default" | "subtle";
5
+ disabled?: boolean;
6
+ };
7
+ /** Content navigation with shared typography, hover and keyboard focus. */
8
+ export declare function Link({ variant, disabled, className, children, onClick, target, rel, ...props }: LinkProps): import("react").JSX.Element;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import s from "./Link.module.css";
4
+ function Link({
5
+ variant = "default",
6
+ disabled = false,
7
+ className = "",
8
+ children,
9
+ onClick,
10
+ target,
11
+ rel,
12
+ ...props
13
+ }) {
14
+ return /* @__PURE__ */ jsx(
15
+ "a",
16
+ {
17
+ ...props,
18
+ target,
19
+ rel: rel ?? (target === "_blank" ? "noopener noreferrer" : void 0),
20
+ className: `${s.link} ${variant === "subtle" ? s.subtle : ""} ${className}`,
21
+ "aria-disabled": disabled || void 0,
22
+ tabIndex: disabled ? -1 : props.tabIndex,
23
+ onClick: (event) => {
24
+ if (disabled) {
25
+ event.preventDefault();
26
+ return;
27
+ }
28
+ onClick?.(event);
29
+ },
30
+ children
31
+ }
32
+ );
33
+ }
34
+ export {
35
+ Link
36
+ };
@@ -0,0 +1,18 @@
1
+ .link {
2
+ color: var(--link-color, var(--accent-ink, var(--accent)));
3
+ font: inherit;
4
+ text-decoration: none;
5
+ text-underline-offset: 3px;
6
+ overflow-wrap: anywhere;
7
+ border-radius: 2px;
8
+ }
9
+ .subtle { color: inherit; }
10
+ .link:hover:not([aria-disabled="true"]) {
11
+ color: var(--link-hover-color, var(--accent-ink, var(--accent)));
12
+ text-decoration: underline;
13
+ }
14
+ .link:focus-visible {
15
+ outline: 2px solid var(--accent-ink, var(--accent));
16
+ outline-offset: 3px;
17
+ }
18
+ .link[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
@@ -3,6 +3,8 @@ import type { TableAppearance } from "./Table";
3
3
  export type MarkdownCodeTheme = "auto" | "github-light" | "github-dark" | "nord" | "dracula";
4
4
  export type MarkdownProps = {
5
5
  children: string;
6
+ /** Reading size in pixels; headings and prose scale together. */
7
+ fontSize?: number;
6
8
  className?: string;
7
9
  codeTheme?: MarkdownCodeTheme;
8
10
  tableProps?: TableAppearance;
@@ -10,4 +12,4 @@ export type MarkdownProps = {
10
12
  components?: Components;
11
13
  };
12
14
  /** Shared GFM rendering; raw HTML is omitted and URL filtering stays enabled. */
13
- export declare function Markdown({ children, className, components, codeTheme, tableProps, }: MarkdownProps): import("react").JSX.Element;
15
+ export declare function Markdown({ children, fontSize, className, components, codeTheme, tableProps, }: MarkdownProps): import("react").JSX.Element;
@@ -130,13 +130,14 @@ function footnoteLabels({ id, prefix }) {
130
130
  }
131
131
  function Markdown({
132
132
  children,
133
+ fontSize,
133
134
  className = "",
134
135
  components,
135
136
  codeTheme = "auto",
136
137
  tableProps = { striped: true }
137
138
  }) {
138
139
  const id = useId();
139
- return /* @__PURE__ */ jsx(MarkdownOptions, { value: { codeTheme, tableProps }, children: /* @__PURE__ */ jsx("div", { className: `${s.markdown} ${className}`, "data-markdown": true, children: /* @__PURE__ */ jsx(
140
+ return /* @__PURE__ */ jsx(MarkdownOptions, { value: { codeTheme, tableProps }, children: /* @__PURE__ */ jsx("div", { className: `${s.markdown} ${className}`, "data-markdown": true, style: fontSize !== void 0 && Number.isFinite(fontSize) ? { fontSize: Math.min(48, Math.max(10, fontSize)) } : void 0, children: /* @__PURE__ */ jsx(
140
141
  ReactMarkdown,
141
142
  {
142
143
  remarkPlugins: plugins,
@@ -16,7 +16,7 @@ function Slider({
16
16
  return /* @__PURE__ */ jsxs("div", { className: s.field, children: [
17
17
  /* @__PURE__ */ jsxs("label", { htmlFor: id, children: [
18
18
  label,
19
- /* @__PURE__ */ jsxs("span", { children: [
19
+ /* @__PURE__ */ jsxs("span", { "aria-hidden": "true", children: [
20
20
  value,
21
21
  suffix
22
22
  ] })
@@ -1,6 +1,7 @@
1
1
  export { Badge } from "./Badge";
2
2
  export { ActionSheet, type ActionSheetItem } from "./ActionSheet";
3
3
  export { Button } from "./Button";
4
+ export { Link, type LinkProps } from "./Link";
4
5
  export { Checkbox } from "./Checkbox";
5
6
  export { ColorField } from "./ColorField";
6
7
  export { DatePicker } from "./DatePicker";
@@ -2,6 +2,7 @@
2
2
  import { Badge } from "./Badge.js";
3
3
  import { ActionSheet } from "./ActionSheet.js";
4
4
  import { Button } from "./Button.js";
5
+ import { Link } from "./Link.js";
5
6
  import { Checkbox } from "./Checkbox.js";
6
7
  import { ColorField } from "./ColorField.js";
7
8
  import { DatePicker } from "./DatePicker.js";
@@ -215,6 +216,7 @@ export {
215
216
  IconSurface,
216
217
  Indicator,
217
218
  Input,
219
+ Link,
218
220
  LoadingOverlay,
219
221
  LoadingState,
220
222
  Mark,
package/package.json CHANGED
@@ -1,12 +1,18 @@
1
1
  {
2
2
  "name": "@robert-stackflow/oneui",
3
- "version": "0.6.20",
3
+ "version": "0.6.21",
4
4
  "description": "OneUI React components, application shell and portable visual themes",
5
5
  "type": "module",
6
6
  "sideEffects": [
7
7
  "**/*.css"
8
8
  ],
9
9
  "exports": {
10
+ "./Link": {
11
+ "types": "./components/Link.d.ts",
12
+ "import": "./components/Link.js",
13
+ "default": "./components/Link.js"
14
+ },
15
+ "./Link.module.css": "./components/Link.module.css",
10
16
  ".": {
11
17
  "types": "./components/index.d.ts",
12
18
  "import": "./components/index.js",