@feedlog-ai/react 0.0.44 → 0.0.46
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/BUILD_FEEDLOG_CLIENT.md +50 -0
- package/BUILD_FEEDLOG_COMPOSABLE.md +85 -0
- package/README.md +4 -2
- package/package.json +5 -3
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Build with the top-level client (`@feedlog-ai/react`)
|
|
2
|
+
|
|
3
|
+
Use **`FeedlogIssuesClient`** when you want props + events and the component performs fetching internally.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- Standard client-rendered apps, or a client boundary in Next.js / RSC setups
|
|
8
|
+
- You do not need the initial HTML to already contain the issues array (for full SSR of issues data, see [BUILD_FEEDLOG_COMPOSABLE.md](./BUILD_FEEDLOG_COMPOSABLE.md))
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @feedlog-ai/react @feedlog-ai/core
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
(`@feedlog-ai/core` is often pulled in as a dependency; install explicitly if your tooling requires it.)
|
|
17
|
+
|
|
18
|
+
## Minimal example
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
'use client';
|
|
22
|
+
|
|
23
|
+
import { FeedlogIssuesClient } from '@feedlog-ai/react';
|
|
24
|
+
|
|
25
|
+
export function Changelog() {
|
|
26
|
+
return (
|
|
27
|
+
<FeedlogIssuesClient
|
|
28
|
+
apiKey="your-api-key"
|
|
29
|
+
type="bug"
|
|
30
|
+
limit={10}
|
|
31
|
+
theme="light"
|
|
32
|
+
maxWidth="42rem"
|
|
33
|
+
onFeedlogUpvote={event => {
|
|
34
|
+
console.log('Issue upvoted:', event.detail);
|
|
35
|
+
}}
|
|
36
|
+
onFeedlogError={event => {
|
|
37
|
+
console.error('Error:', event.detail);
|
|
38
|
+
}}
|
|
39
|
+
/>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
In the **Next.js App Router**, any file that imports `@feedlog-ai/react` for interactive components should be a **Client Component** (`'use client'`), as described in [README](./README.md#nextjs-app-router-or-pages-router).
|
|
45
|
+
|
|
46
|
+
## See also
|
|
47
|
+
|
|
48
|
+
- [README](./README.md) — SSR (`withFeedlogSSR`, `feedlogSSR`), TanStack Start, limitations
|
|
49
|
+
- [Build Your Own Feedlog hub](../../docs/BUILD_YOUR_OWN_FEEDLOG.md)
|
|
50
|
+
- [Customize Feedlog styling](../../docs/CUSTOMIZE_FEEDLOG_STYLING.md)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Composable changelog (`@feedlog-ai/react` + `@feedlog-ai/core`)
|
|
2
|
+
|
|
3
|
+
Use **`FeedlogSDK.fetchIssues`** where your app resolves the API key (server, loader, or client), then render **`FeedlogIssues`** with an **`issues`** prop. You handle **`onFeedlogUpvote`** with **`sdk.toggleUpvote`**.
|
|
4
|
+
|
|
5
|
+
## When to use
|
|
6
|
+
|
|
7
|
+
- **Full SSR** of the issues list (props resolved at request time, no empty flash from client-only fetch inside the widget)
|
|
8
|
+
- **Dynamic props** that Stencil’s static SSR analysis cannot serialize (see [README](./README.md#ssr-limitations))
|
|
9
|
+
|
|
10
|
+
## When not to use imports
|
|
11
|
+
|
|
12
|
+
Do **not** import `FeedlogIssues` from `@feedlog-ai/react/ssr-components` or `@feedlog-ai/react/next` for the issues list. Use the main package: `@feedlog-ai/react`.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install @feedlog-ai/react @feedlog-ai/core
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Server-rendered page (Next.js App Router)
|
|
21
|
+
|
|
22
|
+
```tsx
|
|
23
|
+
// app/changelog/page.tsx
|
|
24
|
+
import { FeedlogIssues } from '@feedlog-ai/react';
|
|
25
|
+
import { FeedlogSDK } from '@feedlog-ai/core';
|
|
26
|
+
|
|
27
|
+
export default async function ChangelogPage() {
|
|
28
|
+
const sdk = new FeedlogSDK({ apiKey: process.env.FEEDLOG_API_KEY! });
|
|
29
|
+
const { issues } = await sdk.fetchIssues({ limit: 10 });
|
|
30
|
+
return <FeedlogIssues issues={issues} theme="light" maxWidth="42rem" />;
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Client upvote handling
|
|
35
|
+
|
|
36
|
+
Upvotes need a browser and your SDK instance (or an API route). Typical pattern: a **client component** wraps `FeedlogIssues`, keeps `issues` in state initialized from server props, and on `onFeedlogUpvote` calls `toggleUpvote` then updates state or re-fetches.
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
'use client';
|
|
40
|
+
|
|
41
|
+
import { useState, useMemo } from 'react';
|
|
42
|
+
import { FeedlogIssues } from '@feedlog-ai/react';
|
|
43
|
+
import { FeedlogSDK, type FeedlogIssue } from '@feedlog-ai/core';
|
|
44
|
+
|
|
45
|
+
export function ChangelogInteractive({ initialIssues }: { initialIssues: FeedlogIssue[] }) {
|
|
46
|
+
const [issues, setIssues] = useState(initialIssues);
|
|
47
|
+
const sdk = useMemo(
|
|
48
|
+
() => new FeedlogSDK({ apiKey: process.env.NEXT_PUBLIC_FEEDLOG_API_KEY! }),
|
|
49
|
+
[]
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<FeedlogIssues
|
|
54
|
+
issues={issues}
|
|
55
|
+
theme="light"
|
|
56
|
+
onFeedlogUpvote={async event => {
|
|
57
|
+
const { issueId } = event.detail;
|
|
58
|
+
await sdk.toggleUpvote(issueId);
|
|
59
|
+
const { issues: next } = await sdk.fetchIssues({ limit: 10 });
|
|
60
|
+
setIssues(next);
|
|
61
|
+
}}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Adjust API key handling for your framework (env, server actions, etc.).
|
|
68
|
+
|
|
69
|
+
## Finer composition
|
|
70
|
+
|
|
71
|
+
You can also use:
|
|
72
|
+
|
|
73
|
+
- **`FeedlogIssuesList`** — list without outer chrome (see package exports)
|
|
74
|
+
- **`FeedlogIssueComponent`** — single card; pass `issue={...}`
|
|
75
|
+
|
|
76
|
+
## Other frameworks
|
|
77
|
+
|
|
78
|
+
- **Pages Router / `getServerSideProps`:** Fetch in the data hook, pass `issues` into `FeedlogIssues` on the page.
|
|
79
|
+
- **Remix / Vite loaders:** Fetch in the loader, pass `issues` as props.
|
|
80
|
+
|
|
81
|
+
## See also
|
|
82
|
+
|
|
83
|
+
- [@feedlog-ai/core README](../core/README.md)
|
|
84
|
+
- [README](./README.md) — SSR plugins and troubleshooting
|
|
85
|
+
- [Build Your Own Feedlog hub](../../docs/BUILD_YOUR_OWN_FEEDLOG.md)
|
package/README.md
CHANGED
|
@@ -158,9 +158,11 @@ The compiler-based SSR (used by Vite, Remix, and Next.js with `feedlogSSR` / `wi
|
|
|
158
158
|
|
|
159
159
|
This is a [documented limitation](https://stenciljs.com/docs/server-side-rendering) of Stencil's compiler approach ("Static props only").
|
|
160
160
|
|
|
161
|
-
### Build
|
|
161
|
+
### Build your own changelog
|
|
162
162
|
|
|
163
|
-
|
|
163
|
+
- [Build Your Own Feedlog (hub)](../../docs/BUILD_YOUR_OWN_FEEDLOG.md) — three tiers (client, composable, core-only) and AI copy-paste blocks
|
|
164
|
+
- [Top-level client](./BUILD_FEEDLOG_CLIENT.md) — `FeedlogIssuesClient`
|
|
165
|
+
- [Composable + your data](./BUILD_FEEDLOG_COMPOSABLE.md) — `FeedlogSDK` + `FeedlogIssues` (full SSR, loaders)
|
|
164
166
|
|
|
165
167
|
### Event Handling
|
|
166
168
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feedlog-ai/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"description": "React bindings for Feedlog Toolkit Web Components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -33,7 +33,9 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
|
-
"dist"
|
|
36
|
+
"dist",
|
|
37
|
+
"BUILD_FEEDLOG_CLIENT.md",
|
|
38
|
+
"BUILD_FEEDLOG_COMPOSABLE.md"
|
|
37
39
|
],
|
|
38
40
|
"sideEffects": false,
|
|
39
41
|
"scripts": {
|
|
@@ -55,7 +57,7 @@
|
|
|
55
57
|
}
|
|
56
58
|
},
|
|
57
59
|
"dependencies": {
|
|
58
|
-
"@feedlog-ai/webcomponents": "^0.0.
|
|
60
|
+
"@feedlog-ai/webcomponents": "^0.0.46"
|
|
59
61
|
},
|
|
60
62
|
"devDependencies": {
|
|
61
63
|
"@jest/test-sequencer": "^29.7.0",
|