@bridgeline-digital/hawk-app-cli 0.1.2-dev.20261027220454 → 0.1.2-dev.20261027234716
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/agents/AGENTS.md +4 -0
- package/docs/bridge/README.md +20 -0
- package/docs/ui/README.md +3 -0
- package/package.json +1 -1
- package/src/dev.mjs +2 -1
package/agents/AGENTS.md
CHANGED
|
@@ -161,6 +161,10 @@ host shows a PDF icon and downloads the whole page; mark buttons and filters `da
|
|
|
161
161
|
(or `app.state.set` and `app.state.onApply`), so users can save, share and link views from HawkSearch's Views menu. One
|
|
162
162
|
small JSON object, never the data.
|
|
163
163
|
|
|
164
|
+
**Deep links:** an app that opens items (edit a widget, a rule) keeps where it is in the UI kit's `useRoute()`
|
|
165
|
+
(`setRoute('/widgets/12')` on open, `setRoute('/')` on close) and shows the page from the route, so a reload or a link
|
|
166
|
+
opens the same item and the browser's Back returns to the list. Stay on one Next.js page and switch on the route.
|
|
167
|
+
|
|
164
168
|
**Ratings and reviews** need no code: users rate the app from HawkSearch's app header. To get each new review by email,
|
|
165
169
|
declare `config.reviewEmails` (`{ "type": "emails" }`) and set it (`hawk-app config set reviewEmails …`).
|
|
166
170
|
|
package/docs/bridge/README.md
CHANGED
|
@@ -1471,6 +1471,26 @@ opened by a link reaches `onApply` even if the app registers it later. The UI ki
|
|
|
1471
1471
|
(`const [filters, setFilters] = useSavedState({ range: 'l13', target: null })`). Errors: `invalid_request` (not a JSON
|
|
1472
1472
|
object, too large). See the platform's docs/saved-views.md.
|
|
1473
1473
|
|
|
1474
|
+
## Deep links and Back
|
|
1475
|
+
|
|
1476
|
+
An app that opens items (a widget, a rule, a report row) keeps where it is in the host's URL, so a reload or a shared
|
|
1477
|
+
link opens the same item, and the browser's Back returns to the list. Name the place with a route, a path from the
|
|
1478
|
+
app's start, and follow the route:
|
|
1479
|
+
|
|
1480
|
+
```ts
|
|
1481
|
+
app.route.current; // "/" at the start, or the route the page opened at
|
|
1482
|
+
app.route.set('/widgets/12'); // the user opened widget 12: a new Back step
|
|
1483
|
+
app.route.set('/widgets/34', { replace: true }); // no Back step: a fix-up (a new item's id once saved)
|
|
1484
|
+
const stop = app.route.onChange((route) => show(route)); // Back, Forward, and the app's own set()
|
|
1485
|
+
```
|
|
1486
|
+
|
|
1487
|
+
Show the page from the route (not from the click alone), so a link and Back land the same way. A route starts with
|
|
1488
|
+
`/`, has no `#`, and is at most 500 characters; query strings are fine (`/widgets/12?tab=layout`). The host keeps it in
|
|
1489
|
+
one query parameter of its own URL (HawkSearch: `?appRoute=`), next to its own. On a host without deep links,
|
|
1490
|
+
`set` still moves the app and tells the listeners, only the URL stays. The UI kit's `useRoute()` does both
|
|
1491
|
+
(`const [route, setRoute] = useRoute()`). Errors: `invalid_request` (not a route). A Next.js app's own routes are not
|
|
1492
|
+
the host's: keep the app on one page and switch on the route.
|
|
1493
|
+
|
|
1474
1494
|
## Errors and usage
|
|
1475
1495
|
|
|
1476
1496
|
`createApp` reports, on its own, one open per page load (the full app or the view showing), the screens and actions
|
package/docs/ui/README.md
CHANGED
|
@@ -52,6 +52,9 @@ export function Page() {
|
|
|
52
52
|
page's state for the host's Views menu, and opening a saved view or its link sets it back.
|
|
53
53
|
`const [filters, setFilters] = useSavedState({ range: 'l13', target: null })`. One small JSON object, once per page.
|
|
54
54
|
See the bridge guide's "Saved views".
|
|
55
|
+
- **`useRoute()`** is the app's route for deep links and Back: `const [route, setRoute] = useRoute()`, show the page
|
|
56
|
+
the route names, and `setRoute('/widgets/12')` when the user opens one (`{ replace: true }` for no Back step). The
|
|
57
|
+
host keeps it in its URL, so a reload or a link opens the same page. See the bridge guide's "Deep links and Back".
|
|
55
58
|
- **`useScreen(name | null)`** counts a screen the routes don't show, such as a tab, each time it's shown:
|
|
56
59
|
`useScreen('Logs')` in the tab's component. Routes and views are counted by the bridge, and so are clicks on
|
|
57
60
|
`data-hawk-usage="Export CSV"` elements. See `hawk-app usage --screens` and the bridge guide's "Errors and usage".
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bridgeline-digital/hawk-app-cli",
|
|
3
|
-
"version": "0.1.2-dev.
|
|
3
|
+
"version": "0.1.2-dev.20261027234716",
|
|
4
4
|
"description": "For Bridgeline developers: create, deploy and register Hawk Apps (Services-built tools embedded in HawkSearch). Requires a Hawk Apps publisher key.",
|
|
5
5
|
"author": "Bridgeline Digital",
|
|
6
6
|
"license": "UNLICENSED",
|
package/src/dev.mjs
CHANGED
|
@@ -637,7 +637,7 @@ export function hostPage(settings) {
|
|
|
637
637
|
<main>
|
|
638
638
|
<div>
|
|
639
639
|
<p id="title"></p>
|
|
640
|
-
<hawk-app-frame id="frame" title="${escapeHtml(settings.name)}"></hawk-app-frame>
|
|
640
|
+
<hawk-app-frame id="frame" title="${escapeHtml(settings.name)}" route-param="appRoute"></hawk-app-frame>
|
|
641
641
|
</div>
|
|
642
642
|
<aside>
|
|
643
643
|
<section><h2>Token</h2><pre id="token">—</pre></section>
|
|
@@ -698,6 +698,7 @@ export function hostPage(settings) {
|
|
|
698
698
|
frame.addEventListener('hawk-ready', () => event('ready'));
|
|
699
699
|
frame.addEventListener('hawk-title', (e) => { $('title').textContent = e.detail.title; document.title = e.detail.title + ' · hawk-app dev'; event('setTitle: ' + e.detail.title); });
|
|
700
700
|
frame.addEventListener('hawk-navigate', (e) => event('navigate: ' + JSON.stringify(e.detail)));
|
|
701
|
+
frame.addEventListener('hawk-route', (e) => event('route: ' + e.detail.route + (e.detail.replace ? ' (replace)' : '')));
|
|
701
702
|
// "Explain this page" (the bar's button) reads this; HawkSearch shows the same button.
|
|
702
703
|
frame.addEventListener('hawk-page-context', (e) => event('page context: ' + (e.detail.context ? JSON.stringify(e.detail.context).slice(0, 300) : 'cleared')));
|
|
703
704
|
// The PDF icon (as in HawkSearch's bar) shows while the page allows it: app.setPdfExport / usePdfExport.
|