@molecule/app-routing-react-router 1.2.3 → 1.2.4
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 +20 -1
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
|
3
3
|
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
4
|
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
5
|
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
-
Generated: 2026-11-
|
|
6
|
+
Generated: 2026-11-09T07:07:09.138Z
|
|
7
7
|
-->
|
|
8
8
|
|
|
9
9
|
# @molecule/app-routing-react-router
|
|
@@ -162,6 +162,25 @@ const topics = useListRoute({
|
|
|
162
162
|
// onPageChange={topics.setPage}; custom links use topics.href({ page: next }).
|
|
163
163
|
```
|
|
164
164
|
|
|
165
|
+
One feed page on `/`, `/?view=following` and `/topics/:topic`: mount it on both routes
|
|
166
|
+
with ONE config, so every tab link comes from `href`. With a separate config per route,
|
|
167
|
+
the topic page cannot build the "all" link, and a hand-written one tends to keep the topic.
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
const feed = useListRoute({
|
|
171
|
+
pageSize: 10,
|
|
172
|
+
selections: {
|
|
173
|
+
all: { path: '/', query: { view: undefined } },
|
|
174
|
+
following: { path: '/', query: { view: 'following' } },
|
|
175
|
+
topic: { path: '/topics/:topic' },
|
|
176
|
+
},
|
|
177
|
+
defaultSelection: 'all',
|
|
178
|
+
})
|
|
179
|
+
// On /topics/design?page=2: feed.selection is 'topic', feed.params.topic is 'design',
|
|
180
|
+
// feed.href({ selection: 'all' }) is '/', feed.href({ page: 3 }) is '/topics/design?page=3'.
|
|
181
|
+
// A topic link names its topic: feed.href({ selection: 'topic', params: { topic: name } }).
|
|
182
|
+
```
|
|
183
|
+
|
|
165
184
|
## Type
|
|
166
185
|
|
|
167
186
|
`provider`
|
package/dist/index.d.ts
CHANGED
|
@@ -122,6 +122,26 @@
|
|
|
122
122
|
* // onPageChange={topics.setPage}; custom links use topics.href({ page: next }).
|
|
123
123
|
* ```
|
|
124
124
|
*
|
|
125
|
+
* @example
|
|
126
|
+
* One feed page on `/`, `/?view=following` and `/topics/:topic`: mount it on both routes
|
|
127
|
+
* with ONE config, so every tab link comes from `href`. With a separate config per route,
|
|
128
|
+
* the topic page cannot build the "all" link, and a hand-written one tends to keep the topic.
|
|
129
|
+
*
|
|
130
|
+
* ```tsx
|
|
131
|
+
* const feed = useListRoute({
|
|
132
|
+
* pageSize: 10,
|
|
133
|
+
* selections: {
|
|
134
|
+
* all: { path: '/', query: { view: undefined } },
|
|
135
|
+
* following: { path: '/', query: { view: 'following' } },
|
|
136
|
+
* topic: { path: '/topics/:topic' },
|
|
137
|
+
* },
|
|
138
|
+
* defaultSelection: 'all',
|
|
139
|
+
* })
|
|
140
|
+
* // On /topics/design?page=2: feed.selection is 'topic', feed.params.topic is 'design',
|
|
141
|
+
* // feed.href({ selection: 'all' }) is '/', feed.href({ page: 3 }) is '/topics/design?page=3'.
|
|
142
|
+
* // A topic link names its topic: feed.href({ selection: 'topic', params: { topic: name } }).
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
125
145
|
* @remarks
|
|
126
146
|
* - `useListRoute` derives state from the URL on every render, including Back/Forward.
|
|
127
147
|
* Do not mirror selection/page in local state or rewrite an explicit public view
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmLG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,YAAY,EACV,WAAW,EACX,eAAe,EACf,eAAe,EACf,WAAW,EACX,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,eAAe,EACf,aAAa,EACb,UAAU,EACV,WAAW,EACX,YAAY,GACb,MAAM,YAAY,CAAA;AACnB,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -122,6 +122,26 @@
|
|
|
122
122
|
* // onPageChange={topics.setPage}; custom links use topics.href({ page: next }).
|
|
123
123
|
* ```
|
|
124
124
|
*
|
|
125
|
+
* @example
|
|
126
|
+
* One feed page on `/`, `/?view=following` and `/topics/:topic`: mount it on both routes
|
|
127
|
+
* with ONE config, so every tab link comes from `href`. With a separate config per route,
|
|
128
|
+
* the topic page cannot build the "all" link, and a hand-written one tends to keep the topic.
|
|
129
|
+
*
|
|
130
|
+
* ```tsx
|
|
131
|
+
* const feed = useListRoute({
|
|
132
|
+
* pageSize: 10,
|
|
133
|
+
* selections: {
|
|
134
|
+
* all: { path: '/', query: { view: undefined } },
|
|
135
|
+
* following: { path: '/', query: { view: 'following' } },
|
|
136
|
+
* topic: { path: '/topics/:topic' },
|
|
137
|
+
* },
|
|
138
|
+
* defaultSelection: 'all',
|
|
139
|
+
* })
|
|
140
|
+
* // On /topics/design?page=2: feed.selection is 'topic', feed.params.topic is 'design',
|
|
141
|
+
* // feed.href({ selection: 'all' }) is '/', feed.href({ page: 3 }) is '/topics/design?page=3'.
|
|
142
|
+
* // A topic link names its topic: feed.href({ selection: 'topic', params: { topic: name } }).
|
|
143
|
+
* ```
|
|
144
|
+
*
|
|
125
145
|
* @remarks
|
|
126
146
|
* - `useListRoute` derives state from the URL on every render, including Back/Forward.
|
|
127
147
|
* Do not mirror selection/page in local state or rewrite an explicit public view
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmLG;AAEH,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAe5B,cAAc,mBAAmB,CAAA;AACjC,cAAc,gBAAgB,CAAA"}
|