@sigx/lynx-daisyui 0.4.5 → 0.4.7

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/dist/index.d.ts CHANGED
@@ -66,3 +66,4 @@ export { Text } from './typography/Text.js';
66
66
  export type { TextProps, TextSize, TextWeight, TextColor } from './typography/Text.js';
67
67
  export { Heading } from './typography/Heading.js';
68
68
  export type { HeadingProps, HeadingLevel } from './typography/Heading.js';
69
+ export { markdownComponents } from './markdown/components.js';
package/dist/index.js CHANGED
@@ -46,3 +46,5 @@ export { Avatar } from './data/Avatar.js';
46
46
  // Typography
47
47
  export { Text } from './typography/Text.js';
48
48
  export { Heading } from './typography/Heading.js';
49
+ // Markdown — daisyUI rendering for `@sigx/lynx-markdown` (optional peer).
50
+ export { markdownComponents } from './markdown/components.js';
@@ -0,0 +1,27 @@
1
+ /**
2
+ * daisyUI rendering for `@sigx/lynx-markdown`.
3
+ *
4
+ * `@sigx/lynx-markdown` is design-system-agnostic: `<MarkdownView>` walks the
5
+ * markdown AST and calls a {@link MarkdownComponents} render function per node
6
+ * type. This module supplies the daisyUI mapping — headings → `<Heading>`, text
7
+ * → `<Text>`, layout → `<Col>`/`<Row>`, themed surfaces/borders via daisyUI
8
+ * utility classes — so markdown output matches the rest of the design system and
9
+ * follows the active theme.
10
+ *
11
+ * The class literals live here in `@sigx/lynx-daisyui/src`, so the app's Tailwind
12
+ * `content` glob (which already scans this package) generates them; and daisyUI's
13
+ * `<Col>`/`<Row>` set `display:flex`, so layout is correct on Lynx.
14
+ *
15
+ * `@sigx/lynx-markdown` is an *optional* peer dependency — importing daisyUI
16
+ * without it is fine; you just don't use `markdownComponents`.
17
+ *
18
+ * @example
19
+ * ```tsx
20
+ * import { MarkdownView } from '@sigx/lynx-markdown';
21
+ * import { markdownComponents } from '@sigx/lynx-daisyui';
22
+ *
23
+ * <MarkdownView value={md} components={markdownComponents} onLink={open} />
24
+ * ```
25
+ */
26
+ import type { MarkdownComponents } from '@sigx/lynx-markdown';
27
+ export declare const markdownComponents: MarkdownComponents;
@@ -0,0 +1,37 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "@sigx/lynx/jsx-runtime";
2
+ import { Heading } from '../typography/Heading.js';
3
+ import { Text } from '../typography/Text.js';
4
+ import { Col } from '../layout/Col.js';
5
+ import { Row } from '../layout/Row.js';
6
+ import { Divider } from '../layout/Divider.js';
7
+ import { Checkbox } from '../forms/Checkbox.js';
8
+ function alignClass(align) {
9
+ return align === 'center' ? 'text-center' : align === 'right' ? 'text-right' : 'text-left';
10
+ }
11
+ export const markdownComponents = {
12
+ root: ({ children }) => _jsx(Col, { gap: 12, children: children }),
13
+ heading: ({ level, children }) => _jsx(Heading, { level: level, children: children }),
14
+ paragraph: ({ children }) => _jsx(Text, { class: "leading-relaxed", children: children }),
15
+ blockquote: ({ children }) => (_jsx(Col, { gap: 8, class: "border-l-4 border-base-300 pl-4 opacity-80", children: children })),
16
+ list: ({ children }) => _jsx(Col, { gap: 4, children: children }),
17
+ listItem: ({ ordered, number, checked, children }) => (_jsxs(Row, { gap: 6, align: "flex-start", children: [checked !== null ? (_jsx(Checkbox, { checked: checked, size: "sm", disabled: true, class: "mt-1" })) : ordered ? (_jsx(Text, { class: "opacity-60 leading-relaxed", children: `${number}.` })) : (_jsx("view", { style: {
18
+ width: 6,
19
+ height: 6,
20
+ borderRadius: 3,
21
+ marginTop: 11,
22
+ backgroundColor: 'rgba(127, 127, 127, 0.9)',
23
+ } })), _jsx(Col, { gap: 4, class: "flex-1", children: children })] })),
24
+ code: ({ lang, value }) => (_jsxs(Col, { gap: 4, background: "base-200", borderRadius: 8, padding: 12, children: [lang ? _jsx(Text, { size: "xs", class: "opacity-60 font-mono", children: lang }) : null, _jsx(Text, { size: "sm", class: "font-mono whitespace-pre-wrap", children: value })] })),
25
+ thematicBreak: () => _jsx(Divider, {}),
26
+ table: ({ children }) => (_jsx(Col, { class: "border border-base-300 rounded-lg overflow-hidden", children: children })),
27
+ tableRow: ({ header, children }) => (_jsx(Row, { class: header ? 'bg-base-200' : '', children: children })),
28
+ tableCell: ({ header, align, children }) => (_jsx("view", { class: "flex-1 px-2 py-1 border-b border-base-300", children: _jsx(Text, { size: "sm", weight: header ? 'semibold' : 'normal', class: alignClass(align), children: children }) })),
29
+ strong: ({ children }) => _jsx("text", { class: "font-bold", children: children }),
30
+ em: ({ children }) => _jsx("text", { class: "italic", children: children }),
31
+ del: ({ children }) => _jsx("text", { class: "line-through opacity-80", children: children }),
32
+ codeSpan: ({ value }) => _jsx("text", { class: "font-mono text-sm bg-base-200 rounded px-1", children: value }),
33
+ link: ({ href, children, onLink }) => (_jsx("text", { class: "text-primary underline", bindtap: () => onLink?.(href), children: children })),
34
+ autolink: ({ href, value, onLink }) => (_jsx("text", { class: "text-primary underline", bindtap: () => onLink?.(href), children: value })),
35
+ image: ({ src, alt, onImageTap }) => (_jsx("text", { class: "text-primary underline", bindtap: () => onImageTap?.(src), children: alt || src })),
36
+ br: () => '\n',
37
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sigx/lynx-daisyui",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "DaisyUI integration for sigx-lynx",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -37,17 +37,21 @@
37
37
  "LICENSE"
38
38
  ],
39
39
  "dependencies": {
40
- "@sigx/lynx": "^0.4.5",
41
- "@sigx/lynx-appearance": "^0.4.5",
42
- "@sigx/lynx-gestures": "^0.4.5",
43
- "@sigx/lynx-icons": "^0.4.5",
44
- "@sigx/lynx-motion": "^0.4.5"
40
+ "@sigx/lynx": "^0.4.7",
41
+ "@sigx/lynx-gestures": "^0.4.7",
42
+ "@sigx/lynx-appearance": "^0.4.7",
43
+ "@sigx/lynx-icons": "^0.4.7",
44
+ "@sigx/lynx-motion": "^0.4.7"
45
45
  },
46
46
  "peerDependencies": {
47
47
  "tailwindcss": "^3.0.0 || ^4.0.0",
48
- "@sigx/lynx-navigation": "^0.4.5"
48
+ "@sigx/lynx-markdown": "^0.4.7",
49
+ "@sigx/lynx-navigation": "^0.4.7"
49
50
  },
50
51
  "peerDependenciesMeta": {
52
+ "@sigx/lynx-markdown": {
53
+ "optional": true
54
+ },
51
55
  "@sigx/lynx-navigation": {
52
56
  "optional": true
53
57
  }
@@ -56,7 +60,8 @@
56
60
  "@typescript/native-preview": "7.0.0-dev.20260521.1",
57
61
  "tailwindcss": "^4.0.0",
58
62
  "typescript": "^6.0.3",
59
- "@sigx/lynx-navigation": "^0.4.5"
63
+ "@sigx/lynx-markdown": "^0.4.7",
64
+ "@sigx/lynx-navigation": "^0.4.7"
60
65
  },
61
66
  "publishConfig": {
62
67
  "access": "public"