@feedlog-ai/react 0.0.32 → 0.0.34
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 +57 -1
- package/dist/ssr-components.d.ts +8 -0
- package/dist/ssr-components.d.ts.map +1 -0
- package/dist/ssr-components.js +8 -0
- package/dist/ssr-components.js.map +1 -0
- package/dist/start.d.ts.map +1 -1
- package/dist/start.js +1 -1
- package/dist/start.js.map +1 -1
- package/dist/vite.d.ts.map +1 -1
- package/dist/vite.js +1 -1
- package/dist/vite.js.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -132,7 +132,15 @@ export default defineConfig({
|
|
|
132
132
|
});
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
**Note:** The SSR plugin requires `@stencil/ssr
|
|
135
|
+
**Note:** The SSR plugin requires `@stencil/ssr`, which declares `vite@^6.x` as a peer dependency. For Vite 7 projects, add this override to your `package.json` to avoid peer dependency conflicts:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
"overrides": {
|
|
139
|
+
"@stencil/ssr": {
|
|
140
|
+
"vite": "$vite"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
136
144
|
|
|
137
145
|
**Troubleshooting:** If you see `Expected ">" but found "{"` during the SSR build, the Stencil transform may be failing on complex TypeScript generics in files that import from `@feedlog-ai/react`. Refactor inline generics to type aliases, e.g.:
|
|
138
146
|
|
|
@@ -146,6 +154,54 @@ interface EventDetail { a: string; b: number }
|
|
|
146
154
|
event: CustomEvent<EventDetail>
|
|
147
155
|
```
|
|
148
156
|
|
|
157
|
+
### SSR Limitations
|
|
158
|
+
|
|
159
|
+
The compiler-based SSR (used by Vite, Remix, and Next.js with `feedlogSSR` / `withFeedlogSSR`) performs **static AST analysis at build time** and cannot resolve runtime values. Dynamic props such as `apiKey={apiKey}` or `theme={theme}` are serialized as their identifier names instead of actual values, which causes broken API calls and incorrect display.
|
|
160
|
+
|
|
161
|
+
- **SSR-safe components** (pre-rendered with Declarative Shadow DOM): `FeedlogBadge`, `FeedlogButton`, `FeedlogCard`
|
|
162
|
+
- **Excluded from SSR** (rendered at request time by React; no pre-rendered DSD): `FeedlogIssuesClient`, `FeedlogIssueComponent`, `FeedlogIssues`, `FeedlogIssuesList` — these receive props correctly at runtime but may show a brief empty state before client hydration
|
|
163
|
+
|
|
164
|
+
This is a [documented limitation](https://stenciljs.com/docs/server-side-rendering) of Stencil's compiler approach ("Static props only").
|
|
165
|
+
|
|
166
|
+
### Copy Instructions: Full SSR for Issues
|
|
167
|
+
|
|
168
|
+
If you need the issues list fully server-rendered (no flash of empty content), create a custom wrapper that fetches issues on the server and passes the data to `FeedlogIssues`.
|
|
169
|
+
|
|
170
|
+
<details>
|
|
171
|
+
<summary>LLM instructions: Build an SSR-compatible issues component</summary>
|
|
172
|
+
|
|
173
|
+
Copy the following into your LLM to generate a custom SSR-compatible issues component:
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
**Context:** The `@stencil/ssr` compiler cannot resolve dynamic props at build time. For full SSR of the issues list, fetch data on the server and pass it to `FeedlogIssues`. Use `FeedlogSDK` from `@feedlog-ai/core` or direct `fetch()` to the Feedlog API.
|
|
178
|
+
|
|
179
|
+
**Implementation patterns:**
|
|
180
|
+
|
|
181
|
+
- **Next.js App Router:** Create an async Server Component that calls `new FeedlogSDK({ apiKey }).fetchIssues()`, then renders `<FeedlogIssues issues={issues} ... />`. Import `FeedlogIssues` from `@feedlog-ai/react`.
|
|
182
|
+
- **Next.js Pages Router:** Use `getServerSideProps` or `getStaticProps` to fetch issues, pass to the page, and render `<FeedlogIssues issues={issues} />`.
|
|
183
|
+
- **Vite / Remix:** Fetch in the route loader, pass data to the page component, and render `FeedlogIssues` with the fetched `issues` array.
|
|
184
|
+
|
|
185
|
+
**Important:** The wrapper must run on the server so props are resolved at request time. Import from `@feedlog-ai/react` (not `@feedlog-ai/react/ssr-components` or `@feedlog-ai/react/next` for the issues components).
|
|
186
|
+
|
|
187
|
+
**Example (Next.js App Router):**
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
// app/issues/page.tsx
|
|
191
|
+
import { FeedlogIssues } from '@feedlog-ai/react';
|
|
192
|
+
import { FeedlogSDK } from '@feedlog-ai/core';
|
|
193
|
+
|
|
194
|
+
export default async function IssuesPage() {
|
|
195
|
+
const sdk = new FeedlogSDK({ apiKey: process.env.FEEDLOG_API_KEY! });
|
|
196
|
+
const { issues } = await sdk.fetchIssues({ limit: 10 });
|
|
197
|
+
return <FeedlogIssues issues={issues} theme="light" />;
|
|
198
|
+
}
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
</details>
|
|
204
|
+
|
|
149
205
|
### Event Handling
|
|
150
206
|
|
|
151
207
|
```tsx
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR-safe components only.
|
|
3
|
+
* Use this entry point for @stencil/ssr to avoid serializing dynamic props
|
|
4
|
+
* (e.g. apiKey) as their identifier names. Components with complex/runtime
|
|
5
|
+
* props (FeedlogIssuesClient, FeedlogIssueComponent, etc.) are excluded.
|
|
6
|
+
*/
|
|
7
|
+
export { FeedlogBadge, FeedlogButton, FeedlogCard } from './index';
|
|
8
|
+
//# sourceMappingURL=ssr-components.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-components.d.ts","sourceRoot":"","sources":["../src/ssr-components.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR-safe components only.
|
|
3
|
+
* Use this entry point for @stencil/ssr to avoid serializing dynamic props
|
|
4
|
+
* (e.g. apiKey) as their identifier names. Components with complex/runtime
|
|
5
|
+
* props (FeedlogIssuesClient, FeedlogIssueComponent, etc.) are excluded.
|
|
6
|
+
*/
|
|
7
|
+
export { FeedlogBadge, FeedlogButton, FeedlogCard } from './index';
|
|
8
|
+
//# sourceMappingURL=ssr-components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssr-components.js","sourceRoot":"","sources":["../src/ssr-components.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/start.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;4DAKI,CAAC;WAAe,CAAC;;CACxC,CAAC"}
|
package/dist/start.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stencilSSR } from '@stencil/ssr';
|
|
2
2
|
export const feedlogSSR = () => stencilSSR({
|
|
3
|
-
module: import('@feedlog-ai/react'),
|
|
3
|
+
module: import('@feedlog-ai/react/ssr-components'),
|
|
4
4
|
from: '@feedlog-ai/react',
|
|
5
5
|
hydrateModule: import('@feedlog-ai/webcomponents/hydrate'),
|
|
6
6
|
serializeShadowRoot: { default: 'declarative-shadow-dom' },
|
package/dist/start.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAC7B,UAAU,CAAC;IACT,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAC7B,UAAU,CAAC;IACT,MAAM,EAAE,MAAM,CAAC,kCAAkC,CAAC;IAClD,IAAI,EAAE,mBAAmB;IACzB,aAAa,EAAE,MAAM,CAAC,mCAAmC,CAAC;IAC1D,mBAAmB,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;CAC3D,CAAC,CAAC"}
|
package/dist/vite.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;
|
|
1
|
+
{"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU;;4DAKI,CAAC;WAAe,CAAC;;CACxC,CAAC"}
|
package/dist/vite.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { stencilSSR } from '@stencil/ssr';
|
|
2
2
|
export const feedlogSSR = () => stencilSSR({
|
|
3
|
-
module: import('@feedlog-ai/react'),
|
|
3
|
+
module: import('@feedlog-ai/react/ssr-components'),
|
|
4
4
|
from: '@feedlog-ai/react',
|
|
5
5
|
hydrateModule: import('@feedlog-ai/webcomponents/hydrate'),
|
|
6
6
|
serializeShadowRoot: { default: 'declarative-shadow-dom' },
|
package/dist/vite.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAC7B,UAAU,CAAC;IACT,MAAM,EAAE,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"vite.js","sourceRoot":"","sources":["../src/vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE,CAC7B,UAAU,CAAC;IACT,MAAM,EAAE,MAAM,CAAC,kCAAkC,CAAC;IAClD,IAAI,EAAE,mBAAmB;IACzB,aAAa,EAAE,MAAM,CAAC,mCAAmC,CAAC;IAC1D,mBAAmB,EAAE,EAAE,OAAO,EAAE,wBAAwB,EAAE;CAC3D,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@feedlog-ai/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
4
4
|
"description": "React bindings for Feedlog Toolkit Web Components",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"require": "./dist/next.js",
|
|
17
17
|
"types": "./dist/next.d.ts"
|
|
18
18
|
},
|
|
19
|
+
"./ssr-components": {
|
|
20
|
+
"import": "./dist/ssr-components.js",
|
|
21
|
+
"require": "./dist/ssr-components.js",
|
|
22
|
+
"types": "./dist/ssr-components.d.ts"
|
|
23
|
+
},
|
|
19
24
|
"./vite": {
|
|
20
25
|
"import": "./dist/vite.js",
|
|
21
26
|
"require": "./dist/vite.js",
|
|
@@ -43,7 +48,7 @@
|
|
|
43
48
|
"react-dom": ">=17.0.0"
|
|
44
49
|
},
|
|
45
50
|
"dependencies": {
|
|
46
|
-
"@feedlog-ai/webcomponents": "^0.0.
|
|
51
|
+
"@feedlog-ai/webcomponents": "^0.0.34"
|
|
47
52
|
},
|
|
48
53
|
"devDependencies": {
|
|
49
54
|
"@jest/test-sequencer": "^29.7.0",
|