@mittwald/flow-react-components 1.7.0-next.3 → 1.7.0-next.5

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.
Files changed (54) hide show
  1. package/AGENTS.md +6 -7
  2. package/MIGRATION.md +56 -0
  3. package/dist/assets/component-index.json +1 -1
  4. package/dist/assets/doc-properties.json +1 -1
  5. package/dist/js/packages/components/src/components/AvatarStack/AvatarStack.mjs +5 -3
  6. package/dist/js/packages/components/src/components/AvatarStack/AvatarStack.mjs.map +1 -1
  7. package/dist/js/packages/components/src/components/Breadcrumb/Breadcrumb.mjs +5 -3
  8. package/dist/js/packages/components/src/components/Breadcrumb/Breadcrumb.mjs.map +1 -1
  9. package/dist/js/packages/components/src/components/CodeBlock/CodeBlock.mjs +6 -3
  10. package/dist/js/packages/components/src/components/CodeBlock/CodeBlock.mjs.map +1 -1
  11. package/dist/js/packages/components/src/components/DonutChart/DonutChart.mjs +5 -3
  12. package/dist/js/packages/components/src/components/DonutChart/DonutChart.mjs.map +1 -1
  13. package/dist/js/packages/components/src/components/Flex/Flex.mjs.map +1 -1
  14. package/dist/js/packages/components/src/components/HeaderNavigation/HeaderNavigation.mjs +5 -3
  15. package/dist/js/packages/components/src/components/HeaderNavigation/HeaderNavigation.mjs.map +1 -1
  16. package/dist/js/packages/components/src/components/ImageCropper/ImageCropper.mjs +5 -3
  17. package/dist/js/packages/components/src/components/ImageCropper/ImageCropper.mjs.map +1 -1
  18. package/dist/js/packages/components/src/components/Legend/Legend.mjs +5 -3
  19. package/dist/js/packages/components/src/components/Legend/Legend.mjs.map +1 -1
  20. package/dist/js/packages/components/src/components/List/model/item/ItemView.mjs.map +1 -1
  21. package/dist/js/packages/components/src/components/Markdown/Markdown.mjs +3 -2
  22. package/dist/js/packages/components/src/components/Markdown/Markdown.mjs.map +1 -1
  23. package/dist/js/packages/components/src/components/OverlayTrigger/components/DialogTrigger/DialogTrigger.mjs +1 -4
  24. package/dist/js/packages/components/src/components/OverlayTrigger/components/DialogTrigger/DialogTrigger.mjs.map +1 -1
  25. package/dist/js/packages/components/src/components/Section/context.mjs +13 -2
  26. package/dist/js/packages/components/src/components/Section/context.mjs.map +1 -1
  27. package/dist/js/packages/components/src/components/SkeletonText/SkeletonText.mjs +6 -4
  28. package/dist/js/packages/components/src/components/SkeletonText/SkeletonText.mjs.map +1 -1
  29. package/dist/js/packages/components/src/components/Table/Table.mjs +5 -3
  30. package/dist/js/packages/components/src/components/Table/Table.mjs.map +1 -1
  31. package/dist/js/packages/components/src/components/Table/components/TableBody/TableBody.mjs.map +1 -1
  32. package/dist/js/packages/components/src/components/Table/components/TableCell/TableCell.mjs.map +1 -1
  33. package/dist/js/packages/components/src/components/Table/components/TableColumn/TableColumn.mjs.map +1 -1
  34. package/dist/js/packages/components/src/components/Table/components/TableFooterRow/TableFooterRow.mjs.map +1 -1
  35. package/dist/js/packages/components/src/components/Table/components/TableHeader/TableHeader.mjs.map +1 -1
  36. package/dist/js/packages/components/src/components/Table/components/TableRow/TableRow.mjs.map +1 -1
  37. package/dist/js/packages/components/src/components/propTypes/index.mjs +10 -0
  38. package/dist/js/packages/components/src/components/propTypes/index.mjs.map +1 -1
  39. package/dist/types/components/AvatarStack/AvatarStack.d.ts +4 -3
  40. package/dist/types/components/Breadcrumb/Breadcrumb.d.ts +4 -3
  41. package/dist/types/components/CodeBlock/CodeBlock.d.ts +4 -3
  42. package/dist/types/components/DonutChart/DonutChart.d.ts +4 -3
  43. package/dist/types/components/HeaderNavigation/HeaderNavigation.d.ts +4 -3
  44. package/dist/types/components/ImageCropper/ImageCropper.d.ts +5 -3
  45. package/dist/types/components/Legend/Legend.d.ts +5 -3
  46. package/dist/types/components/List/model/item/ItemView.d.ts +5 -2
  47. package/dist/types/components/List/typedList.d.ts +17 -13
  48. package/dist/types/components/Markdown/Markdown.d.ts +3 -5
  49. package/dist/types/components/OverlayTrigger/components/DialogTrigger/DialogTrigger.d.ts +1 -4
  50. package/dist/types/components/Section/context.d.ts +4 -0
  51. package/dist/types/components/SkeletonText/SkeletonText.d.ts +4 -3
  52. package/dist/types/components/Table/Table.d.ts +18 -3
  53. package/dist/types/components/propTypes/index.d.ts +20 -0
  54. package/package.json +10 -10
package/AGENTS.md CHANGED
@@ -180,13 +180,12 @@ Why this works the way it does across the remote boundary:
180
180
  Remote generation details:
181
181
 
182
182
  - `@flr-generate all` on the component const marks it for generation.
183
- - `@flr-provider` carries a `flowComponent`'s `type: "provider"` over to the
184
- generated remote component. Without it the remote element is created as a
185
- `"ui"` component and wrapped in a `ClearPropsContext` — which drops every
186
- props context a provider around it just set. It only matters where the
187
- provider actually runs inside the remote tree, i.e. where the component that
188
- renders it is not itself `@flr-generate` (`ModalTrigger` → `OverlayTrigger` →
189
- `DialogTriggerView`).
183
+ - The generated remote component takes the `type` of the local
184
+ `flowComponent(…, { type })` call (`provisionTypeOf`), so write it as a string
185
+ literal — the generator fails otherwise. Created as `"ui"`, a remote
186
+ `"layout"` or `"provider"` component would wrap itself in a
187
+ `ClearPropsContext` and cut every props context a remote composition (`Modal`,
188
+ `List`, …) or a provider around it set.
190
189
  - **A prop that carries rendered output has to be a slot, not a property.** A
191
190
  remote property is transported as data, and a React element carries
192
191
  `$$typeof: Symbol(react.…)` — `postMessage` refuses symbols and rejects the
package/MIGRATION.md CHANGED
@@ -28,6 +28,62 @@ The CLI's own output does detect it and prints the right form.
28
28
 
29
29
  ---
30
30
 
31
+ <a id="list-item-callbacks-without-hooks"></a>
32
+
33
+ ## ListItem: `href` and `textValue` must not call hooks
34
+
35
+ **Since `1.6.0`** · migration · manual change · also applies to
36
+ `@mittwald/flow-remote-react-components`
37
+
38
+ Since 1.6.0 a list skips rendering items that have not changed. To decide that,
39
+ it calls `href` and `textValue` for every item on each render of the list —
40
+ outside the item's own render and as often as it needs. Hooks inside these
41
+ callbacks used to run inside the item and happened to work; now they run in
42
+ another component a varying number of times, and React fails with
43
+ `Rendered more hooks than during the previous render`
44
+ ([React error 310](https://react.dev/errors/310)) as soon as the list
45
+ re-renders.
46
+
47
+ ```diff
48
+ + const projectId = projectGhost.id.use();
49
+ +
50
+ <List.Item
51
+ - href={(c) => buildHref(projectGhost.id.use(), c.id)}
52
+ + href={(c) => buildHref(projectId, c.id)}
53
+ >
54
+ ```
55
+
56
+ For a value that depends on the item, call the hook once and let it return a
57
+ function:
58
+
59
+ ```diff
60
+ + const isNew = useNewEntriesTester();
61
+ +
62
+ <List.Item
63
+ - defaultExpanded={(entry) => entry.useIsNew()}
64
+ + defaultExpanded={(entry) => isNew(entry)}
65
+ >
66
+ ```
67
+
68
+ `defaultExpanded` is still called inside the item, but it is read on mount only
69
+ — keep it free of hooks as well. The item's render function (its children) is
70
+ unaffected: it renders inside the item and may call hooks.
71
+
72
+ ESLint's `react-hooks/rules-of-hooks` does not catch most of these cases: it
73
+ does not treat a method call such as `ghost.id.use()` or `entry.useIsNew()` as a
74
+ hook.
75
+
76
+ **Apply:** Find `ListItem` elements — including the `Item` of a `typedList()` —
77
+ whose `href`, `textValue` or `defaultExpanded` callback calls a hook: a `use…()`
78
+ function, `React.use()`, or a hook-like method such as a ghost's `.use()`. Call
79
+ the hook once in the component that renders the list, store the result in a
80
+ variable, and read that variable inside the callback. Where the value depends on
81
+ the item, have the hook return a function (e.g. a tester or a URL builder) and
82
+ call that function with the item. Hooks in the item's render function (its
83
+ children) are fine and stay.
84
+
85
+ ---
86
+
31
87
  <a id="accordion-variant-deprecated"></a>
32
88
 
33
89
  ## Accordion: `variant` deprecated