@silvery/examples 0.5.2 → 0.5.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.
Files changed (53) hide show
  1. package/LICENSE +21 -0
  2. package/{examples/apps → apps}/aichat/index.tsx +4 -3
  3. package/{examples/apps → apps}/async-data.tsx +4 -4
  4. package/apps/components.tsx +658 -0
  5. package/{examples/apps → apps}/data-explorer.tsx +8 -8
  6. package/{examples/apps → apps}/dev-tools.tsx +35 -19
  7. package/{examples/apps → apps}/inline-bench.tsx +3 -1
  8. package/{examples/apps → apps}/kanban.tsx +20 -22
  9. package/{examples/apps → apps}/layout-ref.tsx +6 -6
  10. package/{examples/apps → apps}/panes/index.tsx +1 -1
  11. package/{examples/apps → apps}/paste-demo.tsx +2 -2
  12. package/{examples/apps → apps}/scroll.tsx +2 -2
  13. package/{examples/apps → apps}/search-filter.tsx +1 -1
  14. package/apps/selection.tsx +342 -0
  15. package/apps/spatial-focus-demo.tsx +368 -0
  16. package/{examples/apps → apps}/task-list.tsx +1 -1
  17. package/apps/terminal-caps-demo.tsx +334 -0
  18. package/apps/text-selection-demo.tsx +189 -0
  19. package/apps/textarea.tsx +155 -0
  20. package/{examples/apps → apps}/theme.tsx +1 -1
  21. package/apps/vterm-demo/index.tsx +216 -0
  22. package/dist/cli.d.mts +1 -0
  23. package/dist/cli.mjs +190 -0
  24. package/dist/cli.mjs.map +1 -0
  25. package/layout/dashboard.tsx +953 -0
  26. package/layout/live-resize.tsx +282 -0
  27. package/layout/overflow.tsx +51 -0
  28. package/layout/text-layout.tsx +283 -0
  29. package/package.json +27 -11
  30. package/bin/cli.ts +0 -294
  31. package/examples/apps/components.tsx +0 -463
  32. package/examples/apps/textarea.tsx +0 -91
  33. /package/{examples/_banner.tsx → _banner.tsx} +0 -0
  34. /package/{examples/apps → apps}/aichat/components.tsx +0 -0
  35. /package/{examples/apps → apps}/aichat/script.ts +0 -0
  36. /package/{examples/apps → apps}/aichat/state.ts +0 -0
  37. /package/{examples/apps → apps}/aichat/types.ts +0 -0
  38. /package/{examples/apps → apps}/app-todo.tsx +0 -0
  39. /package/{examples/apps → apps}/cli-wizard.tsx +0 -0
  40. /package/{examples/apps → apps}/clipboard.tsx +0 -0
  41. /package/{examples/apps → apps}/explorer.tsx +0 -0
  42. /package/{examples/apps → apps}/gallery.tsx +0 -0
  43. /package/{examples/apps → apps}/outline.tsx +0 -0
  44. /package/{examples/apps → apps}/terminal.tsx +0 -0
  45. /package/{examples/apps → apps}/transform.tsx +0 -0
  46. /package/{examples/apps → apps}/virtual-10k.tsx +0 -0
  47. /package/{examples/components → components}/counter.tsx +0 -0
  48. /package/{examples/components → components}/hello.tsx +0 -0
  49. /package/{examples/components → components}/progress-bar.tsx +0 -0
  50. /package/{examples/components → components}/select-list.tsx +0 -0
  51. /package/{examples/components → components}/spinner.tsx +0 -0
  52. /package/{examples/components → components}/text-input.tsx +0 -0
  53. /package/{examples/components → components}/virtual-list.tsx +0 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Bjørn Stabell
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -9,7 +9,7 @@
9
9
  */
10
10
 
11
11
  import React, { useCallback, useEffect, useRef, useMemo } from "react"
12
- import { Box, Text, Spinner, ListView, useTea } from "silvery"
12
+ import { Box, Text, Spinner, ListView, useTea, useWindowSize } from "silvery"
13
13
  import type { ListItemMeta } from "silvery"
14
14
  import { run, useInput, useExit, type Key } from "silvery/runtime"
15
15
  import type { ExampleMeta } from "../../_banner.js"
@@ -53,6 +53,7 @@ export function AIChat({
53
53
  fastMode: boolean
54
54
  }) {
55
55
  const exit = useExit()
56
+ const { rows: termRows } = useWindowSize()
56
57
  const update = useMemo(() => createDemoUpdate(script, fastMode, autoStart), [script, fastMode, autoStart])
57
58
  const [state, send] = useTea(INIT_STATE, update)
58
59
  const footerControlRef = useRef<FooterControl>({ submit: () => {} })
@@ -92,7 +93,7 @@ export function AIChat({
92
93
  <ListView
93
94
  items={state.exchanges}
94
95
  getKey={(ex) => ex.id}
95
- height={process.stdout.rows ?? 24}
96
+ height={termRows}
96
97
  estimateHeight={6}
97
98
  renderItem={renderExchange}
98
99
  scrollTo={state.exchanges.length - 1}
@@ -126,7 +127,7 @@ export function AIChat({
126
127
  export async function main() {
127
128
  const args = process.argv.slice(2)
128
129
  const script = args.includes("--stress") ? generateStressScript() : SCRIPT
129
- const mode = args.includes("--fullscreen") ? "fullscreen" : "inline"
130
+ const mode = args.includes("--inline") ? "inline" : "fullscreen"
130
131
 
131
132
  using handle = await run(
132
133
  <AIChat script={script} autoStart={args.includes("--auto")} fastMode={args.includes("--fast")} />,
@@ -117,7 +117,7 @@ function RecentActivity() {
117
117
  }
118
118
 
119
119
  // Loading fallbacks
120
- function LoadingBox({ label, color }: { label: string; color: string }) {
120
+ function LoadingBox({ label }: { label: string }) {
121
121
  return (
122
122
  <Box borderStyle="round" borderColor="$border" padding={1}>
123
123
  <Text color="$muted">Loading {label}...</Text>
@@ -150,19 +150,19 @@ export function AsyncDataApp() {
150
150
  <Box flexGrow={1} flexDirection="row" gap={1}>
151
151
  {/* Each Suspense boundary loads independently */}
152
152
  <ErrorBoundary fallback={<Text color="$error">User error</Text>}>
153
- <Suspense fallback={<LoadingBox label="user" color="green" />}>
153
+ <Suspense fallback={<LoadingBox label="user" />}>
154
154
  <UserProfile />
155
155
  </Suspense>
156
156
  </ErrorBoundary>
157
157
 
158
158
  <ErrorBoundary fallback={<Text color="$error">Stats error</Text>}>
159
- <Suspense fallback={<LoadingBox label="stats" color="blue" />}>
159
+ <Suspense fallback={<LoadingBox label="stats" />}>
160
160
  <Statistics />
161
161
  </Suspense>
162
162
  </ErrorBoundary>
163
163
 
164
164
  <ErrorBoundary fallback={<Text color="$error">Activity error</Text>}>
165
- <Suspense fallback={<LoadingBox label="activity" color="yellow" />}>
165
+ <Suspense fallback={<LoadingBox label="activity" />}>
166
166
  <RecentActivity />
167
167
  </Suspense>
168
168
  </ErrorBoundary>