@sigx/lynx-daisyui 0.4.8 → 0.4.9
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/README.md +5 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/markdown/toolbar.d.ts +21 -0
- package/dist/markdown/toolbar.js +24 -0
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -272,7 +272,7 @@ expands to `flex: 1 1 auto` which doesn't do what most people expect.
|
|
|
272
272
|
Two bridges into [`@sigx/lynx-markdown`](../lynx-markdown):
|
|
273
273
|
|
|
274
274
|
```tsx
|
|
275
|
-
import { markdownComponents, useMarkdownEditorTheme } from '@sigx/lynx-daisyui';
|
|
275
|
+
import { EditorToolbar, daisyToolbarItem, markdownComponents, useMarkdownEditorTheme } from '@sigx/lynx-daisyui';
|
|
276
276
|
|
|
277
277
|
// Themed rendering: daisyUI typography/colors for every markdown node.
|
|
278
278
|
<MarkdownView value={md} components={markdownComponents} />;
|
|
@@ -281,6 +281,10 @@ import { markdownComponents, useMarkdownEditorTheme } from '@sigx/lynx-daisyui';
|
|
|
281
281
|
// variables (and the built-in theme tokens are oklch, which Lynx can't
|
|
282
282
|
// parse), so this hook reactively resolves the ACTIVE theme's palette to
|
|
283
283
|
// concrete hex color props — a theme switch recolors the editor live.
|
|
284
|
+
// Themed toolbar: daisy Buttons over the generic ToolbarItem contract.
|
|
285
|
+
// Standalone (shown) or via <MarkdownEditor toolbar renderToolbarItem={daisyToolbarItem} />.
|
|
286
|
+
<EditorToolbar controller={ctrl} selection={sel} />;
|
|
287
|
+
|
|
284
288
|
const editorTheme = useMarkdownEditorTheme();
|
|
285
289
|
<MarkdownEditor
|
|
286
290
|
textColor={editorTheme.textColor} // base-content
|
package/dist/index.d.ts
CHANGED
|
@@ -69,3 +69,5 @@ export type { HeadingProps, HeadingLevel } from './typography/Heading.js';
|
|
|
69
69
|
export { markdownComponents } from './markdown/components.js';
|
|
70
70
|
export { useMarkdownEditorTheme } from './markdown/editorTheme.js';
|
|
71
71
|
export type { MarkdownEditorThemeColors } from './markdown/editorTheme.js';
|
|
72
|
+
export { EditorToolbar, daisyToolbarItem } from './markdown/toolbar.js';
|
|
73
|
+
export type { EditorToolbarProps } from './markdown/toolbar.js';
|
package/dist/index.js
CHANGED
|
@@ -50,3 +50,4 @@ export { Heading } from './typography/Heading.js';
|
|
|
50
50
|
// (optional peer).
|
|
51
51
|
export { markdownComponents } from './markdown/components.js';
|
|
52
52
|
export { useMarkdownEditorTheme } from './markdown/editorTheme.js';
|
|
53
|
+
export { EditorToolbar, daisyToolbarItem } from './markdown/toolbar.js';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* daisyUI skin for `@sigx/lynx-markdown`'s editor toolbar — the same
|
|
3
|
+
* {@link ToolbarItem} contract, rendered with daisy `Button`s (ghost when
|
|
4
|
+
* idle, primary when the format is active at the selection).
|
|
5
|
+
*
|
|
6
|
+
* Two ways to use it:
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* // 1. Standalone (e.g. inside a KeyboardStickyView send bar):
|
|
10
|
+
* <EditorToolbar controller={ctrl} selection={sel} />
|
|
11
|
+
*
|
|
12
|
+
* // 2. Re-skin MarkdownEditor's built-in toolbar:
|
|
13
|
+
* <MarkdownEditor toolbar renderToolbarItem={daisyToolbarItem} />
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import { type Define } from '@sigx/lynx';
|
|
17
|
+
import { type MarkdownEditorController, type ToolbarItem, type ToolbarRenderItem, type SelectionState } from '@sigx/lynx-markdown';
|
|
18
|
+
/** daisyUI item rendering — pass to `MarkdownEditor`'s `renderToolbarItem`. */
|
|
19
|
+
export declare const daisyToolbarItem: ToolbarRenderItem;
|
|
20
|
+
export type EditorToolbarProps = Define.Prop<'controller', MarkdownEditorController | null, false> & Define.Prop<'selection', SelectionState | null, false> & Define.Prop<'items', ToolbarItem[], false> & Define.Prop<'class', string, false>;
|
|
21
|
+
export declare const EditorToolbar: import("@sigx/runtime-core").ComponentFactory<EditorToolbarProps, void, {}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "@sigx/lynx/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* daisyUI skin for `@sigx/lynx-markdown`'s editor toolbar — the same
|
|
4
|
+
* {@link ToolbarItem} contract, rendered with daisy `Button`s (ghost when
|
|
5
|
+
* idle, primary when the format is active at the selection).
|
|
6
|
+
*
|
|
7
|
+
* Two ways to use it:
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* // 1. Standalone (e.g. inside a KeyboardStickyView send bar):
|
|
11
|
+
* <EditorToolbar controller={ctrl} selection={sel} />
|
|
12
|
+
*
|
|
13
|
+
* // 2. Re-skin MarkdownEditor's built-in toolbar:
|
|
14
|
+
* <MarkdownEditor toolbar renderToolbarItem={daisyToolbarItem} />
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import { component } from '@sigx/lynx';
|
|
18
|
+
import { EditorToolbar as GenericEditorToolbar, } from '@sigx/lynx-markdown';
|
|
19
|
+
import { Button } from '../buttons/Button.js';
|
|
20
|
+
/** daisyUI item rendering — pass to `MarkdownEditor`'s `renderToolbarItem`. */
|
|
21
|
+
export const daisyToolbarItem = (item, active, run) => (_jsx(Button, { size: "sm", square: true, variant: active ? 'primary' : 'ghost', onPress: run, children: item.label ?? item.id }, item.id));
|
|
22
|
+
export const EditorToolbar = component(({ props }) => {
|
|
23
|
+
return () => (_jsx(GenericEditorToolbar, { controller: props.controller, selection: props.selection, items: props.items, renderItem: daisyToolbarItem, class: props.class }));
|
|
24
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigx/lynx-daisyui",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.9",
|
|
4
4
|
"description": "DaisyUI integration for sigx-lynx",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -37,16 +37,16 @@
|
|
|
37
37
|
"LICENSE"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@sigx/lynx": "^0.4.
|
|
41
|
-
"@sigx/lynx-
|
|
42
|
-
"@sigx/lynx-
|
|
43
|
-
"@sigx/lynx-
|
|
44
|
-
"@sigx/lynx-
|
|
40
|
+
"@sigx/lynx": "^0.4.9",
|
|
41
|
+
"@sigx/lynx-appearance": "^0.4.9",
|
|
42
|
+
"@sigx/lynx-gestures": "^0.4.9",
|
|
43
|
+
"@sigx/lynx-motion": "^0.4.9",
|
|
44
|
+
"@sigx/lynx-icons": "^0.4.9"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"tailwindcss": "^3.0.0 || ^4.0.0",
|
|
48
|
-
"@sigx/lynx-
|
|
49
|
-
"@sigx/lynx-
|
|
48
|
+
"@sigx/lynx-navigation": "^0.4.9",
|
|
49
|
+
"@sigx/lynx-markdown": "^0.4.9"
|
|
50
50
|
},
|
|
51
51
|
"peerDependenciesMeta": {
|
|
52
52
|
"@sigx/lynx-markdown": {
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@typescript/native-preview": "7.0.0-dev.20260521.1",
|
|
61
61
|
"tailwindcss": "^4.0.0",
|
|
62
62
|
"typescript": "^6.0.3",
|
|
63
|
-
"@sigx/lynx-
|
|
64
|
-
"@sigx/lynx-
|
|
63
|
+
"@sigx/lynx-markdown": "^0.4.9",
|
|
64
|
+
"@sigx/lynx-navigation": "^0.4.9"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|