@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,3 @@
1
+ import { n as keyToAnsi, r as parseKey, t as init_key_mapping } from "./key-mapping-D4LR1go6.mjs";
2
+ init_key_mapping();
3
+ export { keyToAnsi, parseKey };
@@ -0,0 +1,130 @@
1
+ import { n as __esmMin } from "./chunk-BSw8zbkd.mjs";
2
+ //#region ../../termless/src/key-mapping.ts
3
+ function normalizeModifier(mod) {
4
+ return MODIFIER_ALIASES[mod.toLowerCase()] ?? mod.toLowerCase();
5
+ }
6
+ /**
7
+ * Parse a key string like "Ctrl+a", "ArrowUp", "Shift+Tab" into a KeyDescriptor.
8
+ *
9
+ * Supports modifier prefixes: Ctrl, Control, Alt, Shift, Meta, Cmd, Option, Super.
10
+ * Modifiers are case-insensitive and separated by "+".
11
+ */
12
+ function parseKey(key) {
13
+ const parts = key.split("+");
14
+ const result = { key: parts.pop() };
15
+ for (const part of parts) switch (normalizeModifier(part)) {
16
+ case "ctrl":
17
+ result.ctrl = true;
18
+ break;
19
+ case "shift":
20
+ result.shift = true;
21
+ break;
22
+ case "alt":
23
+ result.alt = true;
24
+ break;
25
+ case "super":
26
+ result.super = true;
27
+ break;
28
+ }
29
+ return result;
30
+ }
31
+ /**
32
+ * Convert a key descriptor or key string to its ANSI escape sequence.
33
+ *
34
+ * Handles:
35
+ * - Single characters: returned as-is
36
+ * - Named keys (ArrowUp, Enter, Tab, etc.): mapped to standard ANSI sequences
37
+ * - Function keys (F1-F12): mapped to VT220/xterm sequences
38
+ * - Ctrl+letter: ASCII control codes 1-26
39
+ * - Ctrl+Enter: newline (\n)
40
+ * - Alt+key: ESC prefix + key
41
+ */
42
+ function keyToAnsi(key) {
43
+ const desc = typeof key === "string" ? parseKey(key) : key;
44
+ const { key: mainKey, ctrl, alt, shift } = desc;
45
+ const hasSuperOrMeta = desc.super;
46
+ if (ctrl && mainKey.length === 1) {
47
+ const code = mainKey.toLowerCase().charCodeAt(0) - 96;
48
+ if (code >= 1 && code <= 26) return String.fromCharCode(code);
49
+ }
50
+ if (ctrl && mainKey === "Enter") return "\n";
51
+ if ((alt || hasSuperOrMeta) && mainKey.length === 1) return `\x1b${mainKey}`;
52
+ const fkey = FKEY_MAP[mainKey];
53
+ if (fkey !== void 0) {
54
+ if (ctrl || alt || shift || hasSuperOrMeta) {
55
+ const mod = 1 + (shift ? 1 : 0) + (alt ? 2 : 0) + (ctrl ? 4 : 0) + (hasSuperOrMeta ? 8 : 0);
56
+ const fkeyNum = parseInt(mainKey.slice(1));
57
+ if (fkeyNum <= 4) return `\x1b[${fkeyNum + 10};${mod}~`;
58
+ const match = fkey.match(/\x1b\[(\d+)~/);
59
+ if (match) return `\x1b[${match[1]};${mod}~`;
60
+ }
61
+ return fkey;
62
+ }
63
+ const mapped = KEY_MAP[mainKey];
64
+ if (mapped !== void 0) {
65
+ if (mapped === null) return "";
66
+ if ((ctrl || alt || shift || hasSuperOrMeta) && mapped.startsWith("\x1B[")) {
67
+ const mod = 1 + (shift ? 1 : 0) + (alt ? 2 : 0) + (ctrl ? 4 : 0) + (hasSuperOrMeta ? 8 : 0);
68
+ const letterMatch = mapped.match(/\x1b\[([A-H])$/);
69
+ if (letterMatch) return `\x1b[1;${mod}${letterMatch[1]}`;
70
+ const tildeMatch = mapped.match(/\x1b\[(\d+)~$/);
71
+ if (tildeMatch) return `\x1b[${tildeMatch[1]};${mod}~`;
72
+ }
73
+ if (shift && mainKey === "Tab") return "\x1B[Z";
74
+ return mapped;
75
+ }
76
+ if (mainKey.length === 1) {
77
+ if (shift && mainKey.match(/[a-z]/)) return mainKey.toUpperCase();
78
+ return mainKey;
79
+ }
80
+ return mainKey;
81
+ }
82
+ var KEY_MAP, FKEY_MAP, MODIFIER_ALIASES;
83
+ var init_key_mapping = __esmMin((() => {
84
+ KEY_MAP = {
85
+ ArrowUp: "\x1B[A",
86
+ ArrowDown: "\x1B[B",
87
+ ArrowLeft: "\x1B[D",
88
+ ArrowRight: "\x1B[C",
89
+ Home: "\x1B[H",
90
+ End: "\x1B[F",
91
+ PageUp: "\x1B[5~",
92
+ PageDown: "\x1B[6~",
93
+ Enter: "\r",
94
+ Tab: " ",
95
+ Backspace: "",
96
+ Delete: "\x1B[3~",
97
+ Escape: "\x1B",
98
+ Space: " ",
99
+ Control: null,
100
+ Shift: null,
101
+ Alt: null,
102
+ Meta: null
103
+ };
104
+ FKEY_MAP = {
105
+ F1: "\x1BOP",
106
+ F2: "\x1BOQ",
107
+ F3: "\x1BOR",
108
+ F4: "\x1BOS",
109
+ F5: "\x1B[15~",
110
+ F6: "\x1B[17~",
111
+ F7: "\x1B[18~",
112
+ F8: "\x1B[19~",
113
+ F9: "\x1B[20~",
114
+ F10: "\x1B[21~",
115
+ F11: "\x1B[23~",
116
+ F12: "\x1B[24~"
117
+ };
118
+ MODIFIER_ALIASES = {
119
+ ctrl: "ctrl",
120
+ control: "ctrl",
121
+ shift: "shift",
122
+ alt: "alt",
123
+ meta: "super",
124
+ cmd: "super",
125
+ option: "alt",
126
+ super: "super"
127
+ };
128
+ }));
129
+ //#endregion
130
+ export { keyToAnsi as n, parseKey as r, init_key_mapping as t };