@silvery/examples 0.17.3 → 0.17.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 (111) hide show
  1. package/dist/UPNG-ShUlaTDh.mjs +5074 -0
  2. package/dist/__vite-browser-external-2447137e-Bopa5BFR.mjs +4 -0
  3. package/dist/_banner-A70_y2Vi.mjs +43 -0
  4. package/dist/ansi-0VXlUmNn.mjs +16397 -0
  5. package/dist/apng-B0gRaDVT.mjs +3 -0
  6. package/dist/apng-BTRDTfDW.mjs +68 -0
  7. package/dist/apps/aichat/index.mjs +1298 -0
  8. package/dist/apps/app-todo.mjs +138 -0
  9. package/dist/apps/async-data.mjs +203 -0
  10. package/dist/apps/cli-wizard.mjs +338 -0
  11. package/dist/apps/clipboard.mjs +197 -0
  12. package/dist/apps/components.mjs +863 -0
  13. package/dist/apps/data-explorer.mjs +482 -0
  14. package/dist/apps/dev-tools.mjs +396 -0
  15. package/dist/apps/explorer.mjs +697 -0
  16. package/dist/apps/gallery.mjs +765 -0
  17. package/dist/apps/inline-bench.mjs +115 -0
  18. package/dist/apps/kanban.mjs +279 -0
  19. package/dist/apps/layout-ref.mjs +186 -0
  20. package/dist/apps/outline.mjs +202 -0
  21. package/dist/apps/paste-demo.mjs +188 -0
  22. package/dist/apps/scroll.mjs +85 -0
  23. package/dist/apps/search-filter.mjs +286 -0
  24. package/dist/apps/selection.mjs +354 -0
  25. package/dist/apps/spatial-focus-demo.mjs +387 -0
  26. package/dist/apps/task-list.mjs +257 -0
  27. package/dist/apps/terminal-caps-demo.mjs +314 -0
  28. package/dist/apps/terminal.mjs +871 -0
  29. package/dist/apps/text-selection-demo.mjs +253 -0
  30. package/dist/apps/textarea.mjs +177 -0
  31. package/dist/apps/theme.mjs +660 -0
  32. package/dist/apps/transform.mjs +214 -0
  33. package/dist/apps/virtual-10k.mjs +421 -0
  34. package/dist/assets/resvgjs.darwin-arm64-BtufyGW1.node +0 -0
  35. package/dist/backends-Dj-11kZF.mjs +1179 -0
  36. package/dist/backends-U3QwStfO.mjs +3 -0
  37. package/dist/{cli.mjs → bin/cli.mjs} +15 -19
  38. package/dist/chunk-BSw8zbkd.mjs +37 -0
  39. package/dist/components/counter.mjs +47 -0
  40. package/dist/components/hello.mjs +30 -0
  41. package/dist/components/progress-bar.mjs +58 -0
  42. package/dist/components/select-list.mjs +84 -0
  43. package/dist/components/spinner.mjs +56 -0
  44. package/dist/components/text-input.mjs +61 -0
  45. package/dist/components/virtual-list.mjs +50 -0
  46. package/dist/flexily-zero-adapter-ByVzLTFP.mjs +3374 -0
  47. package/dist/gif-B6NGH5gs.mjs +3 -0
  48. package/dist/gif-CfkOF-iG.mjs +71 -0
  49. package/dist/gifenc-BI4ihP_T.mjs +728 -0
  50. package/dist/key-mapping-5oYQdAQE.mjs +3 -0
  51. package/dist/key-mapping-D4LR1go6.mjs +130 -0
  52. package/dist/layout/dashboard.mjs +1203 -0
  53. package/dist/layout/live-resize.mjs +302 -0
  54. package/dist/layout/overflow.mjs +69 -0
  55. package/dist/layout/text-layout.mjs +334 -0
  56. package/dist/node-nsrAOjH4.mjs +1083 -0
  57. package/dist/plugins-CT0DdV_E.mjs +3056 -0
  58. package/dist/resvg-js-Cnk2o49d.mjs +201 -0
  59. package/dist/src-9ZhfQyzD.mjs +814 -0
  60. package/dist/src-CUUOuRH6.mjs +5322 -0
  61. package/dist/src-jO3Zuzjj.mjs +23538 -0
  62. package/dist/usingCtx-CsEf0xO3.mjs +57 -0
  63. package/dist/yoga-adapter-BSQHuMV9.mjs +237 -0
  64. package/package.json +21 -14
  65. package/_banner.tsx +0 -60
  66. package/apps/aichat/components.tsx +0 -469
  67. package/apps/aichat/index.tsx +0 -220
  68. package/apps/aichat/script.ts +0 -460
  69. package/apps/aichat/state.ts +0 -325
  70. package/apps/aichat/types.ts +0 -19
  71. package/apps/app-todo.tsx +0 -201
  72. package/apps/async-data.tsx +0 -196
  73. package/apps/cli-wizard.tsx +0 -332
  74. package/apps/clipboard.tsx +0 -183
  75. package/apps/components.tsx +0 -658
  76. package/apps/data-explorer.tsx +0 -490
  77. package/apps/dev-tools.tsx +0 -395
  78. package/apps/explorer.tsx +0 -731
  79. package/apps/gallery.tsx +0 -653
  80. package/apps/inline-bench.tsx +0 -138
  81. package/apps/kanban.tsx +0 -265
  82. package/apps/layout-ref.tsx +0 -173
  83. package/apps/outline.tsx +0 -160
  84. package/apps/panes/index.tsx +0 -203
  85. package/apps/paste-demo.tsx +0 -185
  86. package/apps/scroll.tsx +0 -80
  87. package/apps/search-filter.tsx +0 -240
  88. package/apps/selection.tsx +0 -346
  89. package/apps/spatial-focus-demo.tsx +0 -372
  90. package/apps/task-list.tsx +0 -271
  91. package/apps/terminal-caps-demo.tsx +0 -317
  92. package/apps/terminal.tsx +0 -784
  93. package/apps/text-selection-demo.tsx +0 -193
  94. package/apps/textarea.tsx +0 -155
  95. package/apps/theme.tsx +0 -515
  96. package/apps/transform.tsx +0 -229
  97. package/apps/virtual-10k.tsx +0 -405
  98. package/apps/vterm-demo/index.tsx +0 -216
  99. package/components/counter.tsx +0 -49
  100. package/components/hello.tsx +0 -38
  101. package/components/progress-bar.tsx +0 -52
  102. package/components/select-list.tsx +0 -54
  103. package/components/spinner.tsx +0 -44
  104. package/components/text-input.tsx +0 -61
  105. package/components/virtual-list.tsx +0 -56
  106. package/dist/cli.d.mts +0 -1
  107. package/dist/cli.mjs.map +0 -1
  108. package/layout/dashboard.tsx +0 -953
  109. package/layout/live-resize.tsx +0 -282
  110. package/layout/overflow.tsx +0 -51
  111. package/layout/text-layout.tsx +0 -283
@@ -0,0 +1,57 @@
1
+ //#region \0@oxc-project+runtime@0.122.0/helpers/usingCtx.js
2
+ function _usingCtx() {
3
+ var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
4
+ var n = Error();
5
+ return n.name = "SuppressedError", n.error = r, n.suppressed = e, n;
6
+ }, e = {}, n = [];
7
+ function using(r, e) {
8
+ if (null != e) {
9
+ if (Object(e) !== e) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
10
+ if (r) var o = e[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
11
+ if (void 0 === o && (o = e[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r)) var t = o;
12
+ if ("function" != typeof o) throw new TypeError("Object is not disposable.");
13
+ t && (o = function o() {
14
+ try {
15
+ t.call(e);
16
+ } catch (r) {
17
+ return Promise.reject(r);
18
+ }
19
+ }), n.push({
20
+ v: e,
21
+ d: o,
22
+ a: r
23
+ });
24
+ } else r && n.push({
25
+ d: e,
26
+ a: r
27
+ });
28
+ return e;
29
+ }
30
+ return {
31
+ e,
32
+ u: using.bind(null, !1),
33
+ a: using.bind(null, !0),
34
+ d: function d() {
35
+ var o, t = this.e, s = 0;
36
+ function next() {
37
+ for (; o = n.pop();) try {
38
+ if (!o.a && 1 === s) return s = 0, n.push(o), Promise.resolve().then(next);
39
+ if (o.d) {
40
+ var r = o.d.call(o.v);
41
+ if (o.a) return s |= 2, Promise.resolve(r).then(next, err);
42
+ } else s |= 1;
43
+ } catch (r) {
44
+ return err(r);
45
+ }
46
+ if (1 === s) return t !== e ? Promise.reject(t) : Promise.resolve();
47
+ if (t !== e) throw t;
48
+ }
49
+ function err(n) {
50
+ return t = t !== e ? new r(n, t) : n, next();
51
+ }
52
+ return next();
53
+ }
54
+ };
55
+ }
56
+ //#endregion
57
+ export { _usingCtx as t };
@@ -0,0 +1,237 @@
1
+ //#region ../packages/ag-term/src/adapters/yoga-adapter.ts
2
+ /**
3
+ * Wraps a Yoga node to implement LayoutNode interface.
4
+ */
5
+ var YogaNodeAdapter = class {
6
+ node;
7
+ yoga;
8
+ hasMeasureFunc = false;
9
+ constructor(node, yoga) {
10
+ this.node = node;
11
+ this.yoga = yoga;
12
+ }
13
+ /** Get the underlying Yoga node (for tree operations) */
14
+ getYogaNode() {
15
+ return this.node;
16
+ }
17
+ insertChild(child, index) {
18
+ const yogaChild = child.getYogaNode();
19
+ this.node.insertChild(yogaChild, index);
20
+ }
21
+ removeChild(child) {
22
+ const yogaChild = child.getYogaNode();
23
+ this.node.removeChild(yogaChild);
24
+ }
25
+ free() {
26
+ this.node.free();
27
+ }
28
+ setMeasureFunc(measureFunc) {
29
+ this.hasMeasureFunc = true;
30
+ this.node.setMeasureFunc((width, widthMode, height, heightMode) => {
31
+ return measureFunc(width, this.measureModeToString(widthMode), height, this.measureModeToString(heightMode));
32
+ });
33
+ }
34
+ markDirty() {
35
+ if (this.hasMeasureFunc) this.node.markDirty();
36
+ }
37
+ measureModeToString(mode) {
38
+ if (mode === this.yoga.MEASURE_MODE_EXACTLY) return "exactly";
39
+ if (mode === this.yoga.MEASURE_MODE_AT_MOST) return "at-most";
40
+ return "undefined";
41
+ }
42
+ setWidth(value) {
43
+ this.node.setWidth(value);
44
+ }
45
+ setWidthPercent(value) {
46
+ this.node.setWidthPercent(value);
47
+ }
48
+ setWidthAuto() {
49
+ this.node.setWidthAuto();
50
+ }
51
+ setHeight(value) {
52
+ this.node.setHeight(value);
53
+ }
54
+ setHeightPercent(value) {
55
+ this.node.setHeightPercent(value);
56
+ }
57
+ setHeightAuto() {
58
+ this.node.setHeightAuto();
59
+ }
60
+ setMinWidth(value) {
61
+ this.node.setMinWidth(value);
62
+ }
63
+ setMinWidthPercent(value) {
64
+ this.node.setMinWidthPercent(value);
65
+ }
66
+ setMinHeight(value) {
67
+ this.node.setMinHeight(value);
68
+ }
69
+ setMinHeightPercent(value) {
70
+ this.node.setMinHeightPercent(value);
71
+ }
72
+ setMaxWidth(value) {
73
+ this.node.setMaxWidth(value);
74
+ }
75
+ setMaxWidthPercent(value) {
76
+ this.node.setMaxWidthPercent(value);
77
+ }
78
+ setMaxHeight(value) {
79
+ this.node.setMaxHeight(value);
80
+ }
81
+ setMaxHeightPercent(value) {
82
+ this.node.setMaxHeightPercent(value);
83
+ }
84
+ setFlexGrow(value) {
85
+ this.node.setFlexGrow(value);
86
+ }
87
+ setFlexShrink(value) {
88
+ this.node.setFlexShrink(value);
89
+ }
90
+ setFlexBasis(value) {
91
+ this.node.setFlexBasis(value);
92
+ }
93
+ setFlexBasisPercent(value) {
94
+ this.node.setFlexBasisPercent(value);
95
+ }
96
+ setFlexBasisAuto() {
97
+ this.node.setFlexBasisAuto();
98
+ }
99
+ setFlexDirection(direction) {
100
+ this.node.setFlexDirection(direction);
101
+ }
102
+ setFlexWrap(wrap) {
103
+ this.node.setFlexWrap(wrap);
104
+ }
105
+ setAlignItems(align) {
106
+ this.node.setAlignItems(align);
107
+ }
108
+ setAlignSelf(align) {
109
+ this.node.setAlignSelf(align);
110
+ }
111
+ setAlignContent(align) {
112
+ this.node.setAlignContent(align);
113
+ }
114
+ setJustifyContent(justify) {
115
+ this.node.setJustifyContent(justify);
116
+ }
117
+ setPadding(edge, value) {
118
+ this.node.setPadding(edge, value);
119
+ }
120
+ setMargin(edge, value) {
121
+ this.node.setMargin(edge, value);
122
+ }
123
+ setBorder(edge, value) {
124
+ this.node.setBorder(edge, value);
125
+ }
126
+ setGap(gutter, value) {
127
+ this.node.setGap(gutter, value);
128
+ }
129
+ setDisplay(display) {
130
+ this.node.setDisplay(display);
131
+ }
132
+ setPositionType(positionType) {
133
+ this.node.setPositionType(positionType);
134
+ }
135
+ setPosition(edge, value) {
136
+ this.node.setPosition(edge, value);
137
+ }
138
+ setPositionPercent(edge, value) {
139
+ this.node.setPositionPercent(edge, value);
140
+ }
141
+ setOverflow(overflow) {
142
+ this.node.setOverflow(overflow);
143
+ }
144
+ setAspectRatio(value) {
145
+ this.node.setAspectRatio(value);
146
+ }
147
+ calculateLayout(width, height, direction) {
148
+ this.node.calculateLayout(width, height, direction ?? this.yoga.DIRECTION_LTR);
149
+ }
150
+ getComputedLeft() {
151
+ return this.node.getComputedLeft();
152
+ }
153
+ getComputedTop() {
154
+ return this.node.getComputedTop();
155
+ }
156
+ getComputedWidth() {
157
+ return this.node.getComputedWidth();
158
+ }
159
+ getComputedHeight() {
160
+ return this.node.getComputedHeight();
161
+ }
162
+ };
163
+ /**
164
+ * Layout engine implementation using Yoga (WASM).
165
+ */
166
+ var YogaLayoutEngine = class {
167
+ yoga;
168
+ _constants;
169
+ constructor(yoga) {
170
+ this.yoga = yoga;
171
+ this._constants = {
172
+ FLEX_DIRECTION_COLUMN: yoga.FLEX_DIRECTION_COLUMN,
173
+ FLEX_DIRECTION_COLUMN_REVERSE: yoga.FLEX_DIRECTION_COLUMN_REVERSE,
174
+ FLEX_DIRECTION_ROW: yoga.FLEX_DIRECTION_ROW,
175
+ FLEX_DIRECTION_ROW_REVERSE: yoga.FLEX_DIRECTION_ROW_REVERSE,
176
+ WRAP_NO_WRAP: yoga.WRAP_NO_WRAP,
177
+ WRAP_WRAP: yoga.WRAP_WRAP,
178
+ WRAP_WRAP_REVERSE: yoga.WRAP_WRAP_REVERSE,
179
+ ALIGN_AUTO: yoga.ALIGN_AUTO,
180
+ ALIGN_FLEX_START: yoga.ALIGN_FLEX_START,
181
+ ALIGN_CENTER: yoga.ALIGN_CENTER,
182
+ ALIGN_FLEX_END: yoga.ALIGN_FLEX_END,
183
+ ALIGN_STRETCH: yoga.ALIGN_STRETCH,
184
+ ALIGN_BASELINE: yoga.ALIGN_BASELINE,
185
+ ALIGN_SPACE_BETWEEN: yoga.ALIGN_SPACE_BETWEEN,
186
+ ALIGN_SPACE_AROUND: yoga.ALIGN_SPACE_AROUND,
187
+ ALIGN_SPACE_EVENLY: yoga.ALIGN_SPACE_EVENLY,
188
+ JUSTIFY_FLEX_START: yoga.JUSTIFY_FLEX_START,
189
+ JUSTIFY_CENTER: yoga.JUSTIFY_CENTER,
190
+ JUSTIFY_FLEX_END: yoga.JUSTIFY_FLEX_END,
191
+ JUSTIFY_SPACE_BETWEEN: yoga.JUSTIFY_SPACE_BETWEEN,
192
+ JUSTIFY_SPACE_AROUND: yoga.JUSTIFY_SPACE_AROUND,
193
+ JUSTIFY_SPACE_EVENLY: yoga.JUSTIFY_SPACE_EVENLY,
194
+ EDGE_LEFT: yoga.EDGE_LEFT,
195
+ EDGE_TOP: yoga.EDGE_TOP,
196
+ EDGE_RIGHT: yoga.EDGE_RIGHT,
197
+ EDGE_BOTTOM: yoga.EDGE_BOTTOM,
198
+ EDGE_HORIZONTAL: yoga.EDGE_HORIZONTAL,
199
+ EDGE_VERTICAL: yoga.EDGE_VERTICAL,
200
+ EDGE_ALL: yoga.EDGE_ALL,
201
+ GUTTER_COLUMN: yoga.GUTTER_COLUMN,
202
+ GUTTER_ROW: yoga.GUTTER_ROW,
203
+ GUTTER_ALL: yoga.GUTTER_ALL,
204
+ DISPLAY_FLEX: yoga.DISPLAY_FLEX,
205
+ DISPLAY_NONE: yoga.DISPLAY_NONE,
206
+ POSITION_TYPE_STATIC: yoga.POSITION_TYPE_STATIC,
207
+ POSITION_TYPE_RELATIVE: yoga.POSITION_TYPE_RELATIVE,
208
+ POSITION_TYPE_ABSOLUTE: yoga.POSITION_TYPE_ABSOLUTE,
209
+ OVERFLOW_VISIBLE: yoga.OVERFLOW_VISIBLE,
210
+ OVERFLOW_HIDDEN: yoga.OVERFLOW_HIDDEN,
211
+ OVERFLOW_SCROLL: yoga.OVERFLOW_SCROLL,
212
+ DIRECTION_LTR: yoga.DIRECTION_LTR,
213
+ MEASURE_MODE_UNDEFINED: yoga.MEASURE_MODE_UNDEFINED,
214
+ MEASURE_MODE_EXACTLY: yoga.MEASURE_MODE_EXACTLY,
215
+ MEASURE_MODE_AT_MOST: yoga.MEASURE_MODE_AT_MOST
216
+ };
217
+ }
218
+ createNode() {
219
+ return new YogaNodeAdapter(this.yoga.Node.create(), this.yoga);
220
+ }
221
+ get constants() {
222
+ return this._constants;
223
+ }
224
+ get name() {
225
+ return "yoga";
226
+ }
227
+ };
228
+ /**
229
+ * Initialize Yoga and create a layout engine.
230
+ * Uses yoga-wasm-web/auto which automatically selects the right implementation.
231
+ */
232
+ async function initYogaEngine() {
233
+ const { default: yoga } = await import("./node-nsrAOjH4.mjs");
234
+ return new YogaLayoutEngine(yoga);
235
+ }
236
+ //#endregion
237
+ export { initYogaEngine };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silvery/examples",
3
- "version": "0.17.3",
3
+ "version": "0.17.5",
4
4
  "description": "Example apps and component demos for silvery — npx @silvery/examples <name>",
5
5
  "license": "MIT",
6
6
  "author": "Bjørn Stabell <bjorn@stabell.org>",
@@ -11,17 +11,10 @@
11
11
  },
12
12
  "type": "module",
13
13
  "bin": {
14
- "silvery-examples": "./dist/cli.mjs"
14
+ "silvery-examples": "./dist/bin/cli.mjs"
15
15
  },
16
16
  "files": [
17
- "dist",
18
- "components",
19
- "apps",
20
- "layout",
21
- "runtime",
22
- "inline",
23
- "kitty",
24
- "_banner.tsx"
17
+ "dist"
25
18
  ],
26
19
  "exports": {
27
20
  ".": {
@@ -33,13 +26,27 @@
33
26
  "access": "public"
34
27
  },
35
28
  "tsdown": {
36
- "entry": "bin/cli.ts",
29
+ "entry": [
30
+ "bin/cli.ts",
31
+ "components/*.tsx",
32
+ "apps/*.tsx",
33
+ "apps/aichat/index.tsx",
34
+ "layout/*.tsx"
35
+ ],
37
36
  "format": "esm",
38
- "dts": true,
39
- "clean": true
37
+ "dts": false,
38
+ "clean": true,
39
+ "external": [
40
+ "silvery",
41
+ "silvery/*",
42
+ "react",
43
+ "loggily"
44
+ ]
40
45
  },
41
46
  "dependencies": {
42
- "silvery": "0.17.3"
47
+ "silvery": "0.17.3",
48
+ "react": "^19.0.0",
49
+ "loggily": "^0.6.0"
43
50
  },
44
51
  "engines": {
45
52
  "bun": ">=1.0",
package/_banner.tsx DELETED
@@ -1,60 +0,0 @@
1
- import React from "react"
2
- import { Box, Text, Strong, Muted, ThemeProvider, getThemeByName, type Theme } from "silvery"
3
-
4
- export interface ExampleMeta {
5
- name: string
6
- description: string
7
- /** API features showcased, e.g. ["ListView", "useBoxRect()"] */
8
- features?: string[]
9
- /** Curated demo — shown in CLI viewer (`bun examples`) and web showcase */
10
- demo?: boolean
11
- }
12
-
13
- interface Props {
14
- meta: ExampleMeta
15
- /** Short controls legend, e.g. "j/k navigate q quit" */
16
- controls?: string
17
- /** Override theme (from viewer). Falls back to SILVERY_THEME env var. */
18
- theme?: Theme
19
- children: React.ReactNode
20
- }
21
-
22
- /**
23
- * Compact header shown when examples run standalone.
24
- * Wraps children in ThemeProvider for consistent theming.
25
- */
26
- export function ExampleBanner({ meta, controls, theme, children }: Props) {
27
- const resolvedTheme = theme ?? getThemeByName(process.env.SILVERY_THEME)
28
-
29
- return (
30
- <ThemeProvider theme={resolvedTheme}>
31
- <Box flexDirection="column" flexGrow={1}>
32
- {/* One-line header: dimmed to not compete with example UI */}
33
- <Box paddingX={1} gap={1}>
34
- <Text dim color="$warning">
35
- {"▸ silvery"}
36
- </Text>
37
- <Strong>{meta.name}</Strong>
38
- <Muted>— {meta.description}</Muted>
39
- </Box>
40
- {meta.features && meta.features.length > 0 && (
41
- <Box paddingX={1}>
42
- <Muted>
43
- {" "}
44
- {meta.features.join(" · ")}
45
- </Muted>
46
- </Box>
47
- )}
48
- {controls && (
49
- <Box paddingX={1}>
50
- <Muted>
51
- {" "}
52
- {controls}
53
- </Muted>
54
- </Box>
55
- )}
56
- {children}
57
- </Box>
58
- </ThemeProvider>
59
- )
60
- }