@devtime-ltd/ui-bench 0.0.0-stage → 0.1.0

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 (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +247 -2
  3. package/dist/cjs/UiBench.js +67 -0
  4. package/dist/cjs/UiBench.native.js +77 -0
  5. package/dist/cjs/core/controller.js +147 -0
  6. package/dist/cjs/core/entry.js +35 -0
  7. package/dist/cjs/core/fixtures.js +102 -0
  8. package/dist/cjs/core/fragment.js +107 -0
  9. package/dist/cjs/core/inputs.js +83 -0
  10. package/dist/cjs/core/prefs.js +76 -0
  11. package/dist/cjs/core/props.js +16 -0
  12. package/dist/cjs/core/stage.js +129 -0
  13. package/dist/cjs/core/viewports.js +49 -0
  14. package/dist/cjs/dom/ControlBar.js +34 -0
  15. package/dist/cjs/dom/FixturePicker.js +105 -0
  16. package/dist/cjs/dom/Frame.js +171 -0
  17. package/dist/cjs/dom/InputsPanel.js +47 -0
  18. package/dist/cjs/dom/Landing.js +32 -0
  19. package/dist/cjs/dom/hashUrl.js +35 -0
  20. package/dist/cjs/dom/styles.js +261 -0
  21. package/dist/cjs/index.js +44 -0
  22. package/dist/cjs/native/Box.js +47 -0
  23. package/dist/cjs/native/ControlBar.js +50 -0
  24. package/dist/cjs/native/FixturePicker.js +65 -0
  25. package/dist/cjs/native/InputsPanel.js +67 -0
  26. package/dist/cjs/native/Landing.js +42 -0
  27. package/dist/cjs/native/Triangle.js +43 -0
  28. package/dist/cjs/native/theme.js +49 -0
  29. package/dist/cjs/package.json +1 -0
  30. package/dist/cjs/testing/index.js +59 -0
  31. package/dist/esm/UiBench.d.ts +2 -0
  32. package/dist/esm/UiBench.js +41 -0
  33. package/dist/esm/UiBench.js.map +1 -0
  34. package/dist/esm/UiBench.native.d.ts +2 -0
  35. package/dist/esm/UiBench.native.js +51 -0
  36. package/dist/esm/UiBench.native.js.map +1 -0
  37. package/dist/esm/core/controller.d.ts +43 -0
  38. package/dist/esm/core/controller.js +122 -0
  39. package/dist/esm/core/controller.js.map +1 -0
  40. package/dist/esm/core/entry.d.ts +8 -0
  41. package/dist/esm/core/entry.js +10 -0
  42. package/dist/esm/core/entry.js.map +1 -0
  43. package/dist/esm/core/fixtures.d.ts +27 -0
  44. package/dist/esm/core/fixtures.js +71 -0
  45. package/dist/esm/core/fixtures.js.map +1 -0
  46. package/dist/esm/core/fragment.d.ts +14 -0
  47. package/dist/esm/core/fragment.js +85 -0
  48. package/dist/esm/core/fragment.js.map +1 -0
  49. package/dist/esm/core/inputs.d.ts +30 -0
  50. package/dist/esm/core/inputs.js +52 -0
  51. package/dist/esm/core/inputs.js.map +1 -0
  52. package/dist/esm/core/prefs.d.ts +18 -0
  53. package/dist/esm/core/prefs.js +47 -0
  54. package/dist/esm/core/prefs.js.map +1 -0
  55. package/dist/esm/core/props.d.ts +23 -0
  56. package/dist/esm/core/props.js +2 -0
  57. package/dist/esm/core/props.js.map +1 -0
  58. package/dist/esm/core/stage.d.ts +50 -0
  59. package/dist/esm/core/stage.js +98 -0
  60. package/dist/esm/core/stage.js.map +1 -0
  61. package/dist/esm/core/viewports.d.ts +10 -0
  62. package/dist/esm/core/viewports.js +15 -0
  63. package/dist/esm/core/viewports.js.map +1 -0
  64. package/dist/esm/dom/ControlBar.d.ts +4 -0
  65. package/dist/esm/dom/ControlBar.js +8 -0
  66. package/dist/esm/dom/ControlBar.js.map +1 -0
  67. package/dist/esm/dom/FixturePicker.d.ts +6 -0
  68. package/dist/esm/dom/FixturePicker.js +82 -0
  69. package/dist/esm/dom/FixturePicker.js.map +1 -0
  70. package/dist/esm/dom/Frame.d.ts +9 -0
  71. package/dist/esm/dom/Frame.js +151 -0
  72. package/dist/esm/dom/Frame.js.map +1 -0
  73. package/dist/esm/dom/InputsPanel.d.ts +7 -0
  74. package/dist/esm/dom/InputsPanel.js +21 -0
  75. package/dist/esm/dom/InputsPanel.js.map +1 -0
  76. package/dist/esm/dom/Landing.d.ts +6 -0
  77. package/dist/esm/dom/Landing.js +6 -0
  78. package/dist/esm/dom/Landing.js.map +1 -0
  79. package/dist/esm/dom/hashUrl.d.ts +2 -0
  80. package/dist/esm/dom/hashUrl.js +9 -0
  81. package/dist/esm/dom/hashUrl.js.map +1 -0
  82. package/dist/esm/dom/styles.d.ts +1 -0
  83. package/dist/esm/dom/styles.js +235 -0
  84. package/dist/esm/dom/styles.js.map +1 -0
  85. package/dist/esm/index.d.ts +8 -0
  86. package/dist/esm/index.js +6 -0
  87. package/dist/esm/index.js.map +1 -0
  88. package/dist/esm/native/Box.d.ts +10 -0
  89. package/dist/esm/native/Box.js +21 -0
  90. package/dist/esm/native/Box.js.map +1 -0
  91. package/dist/esm/native/ControlBar.d.ts +5 -0
  92. package/dist/esm/native/ControlBar.js +24 -0
  93. package/dist/esm/native/ControlBar.js.map +1 -0
  94. package/dist/esm/native/FixturePicker.d.ts +6 -0
  95. package/dist/esm/native/FixturePicker.js +39 -0
  96. package/dist/esm/native/FixturePicker.js.map +1 -0
  97. package/dist/esm/native/InputsPanel.d.ts +7 -0
  98. package/dist/esm/native/InputsPanel.js +41 -0
  99. package/dist/esm/native/InputsPanel.js.map +1 -0
  100. package/dist/esm/native/Landing.d.ts +8 -0
  101. package/dist/esm/native/Landing.js +20 -0
  102. package/dist/esm/native/Landing.js.map +1 -0
  103. package/dist/esm/native/Triangle.d.ts +4 -0
  104. package/dist/esm/native/Triangle.js +17 -0
  105. package/dist/esm/native/Triangle.js.map +1 -0
  106. package/dist/esm/native/theme.d.ts +18 -0
  107. package/dist/esm/native/theme.js +19 -0
  108. package/dist/esm/native/theme.js.map +1 -0
  109. package/dist/esm/testing/index.d.ts +21 -0
  110. package/dist/esm/testing/index.js +33 -0
  111. package/dist/esm/testing/index.js.map +1 -0
  112. package/package.json +84 -4
@@ -0,0 +1,235 @@
1
+ export const CSS = `
2
+ .uib-root, .uib-bare {
3
+ --uib-bar: #050505;
4
+ --uib-bar-fg: #f4f4f4;
5
+ --uib-bar-dim: #a8a8a8;
6
+ --uib-bar-line: #3d3d3d;
7
+ --uib-surround: color-mix(in srgb, var(--uib-bar) 90%, #fff);
8
+ --uib-accent: #ff8844;
9
+ --uib-stage: #ffffff;
10
+ --uib-stage-fg: #16181d;
11
+ --uib-stage-dim: #6b7280;
12
+ --uib-stage-line: #d8dbe2;
13
+ --uib-danger: #c62828;
14
+ position: fixed;
15
+ inset: 0;
16
+ font: 12px/16px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
17
+ background: var(--uib-stage);
18
+ color: var(--uib-stage-fg);
19
+ color-scheme: light;
20
+ }
21
+ .uib-root[data-mode="dark"], .uib-bare[data-mode="dark"] {
22
+ --uib-stage: #101216;
23
+ --uib-stage-fg: #eceef2;
24
+ --uib-stage-dim: #8b93a3;
25
+ --uib-stage-line: #2b303b;
26
+ --uib-danger: #ff8a80;
27
+ color-scheme: dark;
28
+ }
29
+ .uib-root { display: flex; flex-direction: column; }
30
+ .uib-bare { overflow: auto; }
31
+ .uib-root *, .uib-root *::before, .uib-root *::after { box-sizing: border-box; }
32
+ .uib-bar {
33
+ flex: none;
34
+ display: flex;
35
+ align-items: center;
36
+ gap: 8px;
37
+ min-height: 32px;
38
+ padding: 4px 8px;
39
+ background: var(--uib-bar);
40
+ color: var(--uib-bar-fg);
41
+ position: relative;
42
+ z-index: 2;
43
+ }
44
+ .uib-mark { color: var(--uib-accent); font-weight: 700; white-space: nowrap; }
45
+ @media (max-width: 560px) { .uib-mark-rest { display: none; } }
46
+ .uib-spacer { flex: 1; }
47
+ .uib-box {
48
+ appearance: none;
49
+ display: inline-flex;
50
+ align-items: center;
51
+ gap: 6px;
52
+ height: 22px;
53
+ margin: 0;
54
+ padding: 0 8px;
55
+ border: 1px solid var(--uib-bar-line);
56
+ border-radius: 0;
57
+ background: transparent;
58
+ color: inherit;
59
+ font: inherit;
60
+ cursor: pointer;
61
+ white-space: nowrap;
62
+ }
63
+ .uib-box:hover, .uib-box:focus-visible { border-color: var(--uib-accent); outline: none; }
64
+ .uib-box:disabled { opacity: 0.4; cursor: default; border-color: var(--uib-bar-line); }
65
+ .uib-box[aria-pressed="true"] { border-color: var(--uib-accent); color: var(--uib-accent); }
66
+ .uib-box-accent { border-color: var(--uib-accent); color: var(--uib-accent); }
67
+ .uib-box option { color: initial; }
68
+ .uib-tri { flex: none; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; }
69
+ .uib-root[data-edge="bottom"] .uib-tri { border-bottom: 5px solid currentColor; }
70
+ .uib-root[data-edge="top"] .uib-tri { border-top: 5px solid currentColor; }
71
+ .uib-select { position: relative; display: inline-flex; }
72
+ .uib-select > .uib-box { padding-right: 22px; }
73
+ .uib-select > .uib-tri { position: absolute; right: 8px; top: 50%; margin-top: -2.5px; pointer-events: none; }
74
+ .uib-picker { position: relative; min-width: 0; }
75
+ .uib-picker > .uib-box { max-width: 50vw; }
76
+ .uib-picker-label { overflow: hidden; text-overflow: ellipsis; }
77
+ .uib-popover {
78
+ position: absolute;
79
+ left: 0;
80
+ width: min(360px, 90vw);
81
+ max-height: min(60vh, 480px);
82
+ display: flex;
83
+ flex-direction: column;
84
+ background: var(--uib-bar);
85
+ border: 1px solid var(--uib-bar-line);
86
+ }
87
+ .uib-root[data-edge="bottom"] .uib-popover { bottom: 28px; }
88
+ .uib-root[data-edge="top"] .uib-popover { top: 28px; }
89
+ .uib-search {
90
+ flex: none;
91
+ margin: 0;
92
+ padding: 8px;
93
+ border: 0;
94
+ border-bottom: 1px solid var(--uib-bar-line);
95
+ border-radius: 0;
96
+ background: transparent;
97
+ color: inherit;
98
+ font: inherit;
99
+ outline: none;
100
+ }
101
+ .uib-search::placeholder { color: var(--uib-bar-dim); }
102
+ .uib-list { overflow: auto; padding: 4px 0; }
103
+ .uib-group { padding: 6px 8px 2px; color: var(--uib-bar-dim); }
104
+ .uib-option {
105
+ appearance: none;
106
+ display: block;
107
+ width: 100%;
108
+ margin: 0;
109
+ padding: 4px 8px;
110
+ border: 0;
111
+ border-radius: 0;
112
+ background: transparent;
113
+ color: inherit;
114
+ font: inherit;
115
+ text-align: left;
116
+ cursor: pointer;
117
+ }
118
+ .uib-option[data-nested="true"] { padding-left: 20px; }
119
+ .uib-option[data-active="true"] { background: var(--uib-bar-line); }
120
+ .uib-option[aria-selected="true"] { color: var(--uib-accent); }
121
+ .uib-none { padding: 8px; color: var(--uib-bar-dim); }
122
+ .uib-panel {
123
+ flex: none;
124
+ display: flex;
125
+ flex-direction: column;
126
+ gap: 6px;
127
+ padding: 8px;
128
+ background: var(--uib-bar);
129
+ color: var(--uib-bar-fg);
130
+ border-top: 1px solid var(--uib-bar-line);
131
+ border-bottom: 1px solid var(--uib-bar-line);
132
+ }
133
+ .uib-panel-head { display: flex; align-items: center; gap: 8px; }
134
+ .uib-panel-title { color: var(--uib-bar-dim); }
135
+ .uib-raw {
136
+ width: 100%;
137
+ min-height: 96px;
138
+ max-height: 40vh;
139
+ margin: 0;
140
+ padding: 8px;
141
+ border: 1px solid var(--uib-bar-line);
142
+ border-radius: 0;
143
+ background: transparent;
144
+ color: inherit;
145
+ font: inherit;
146
+ resize: vertical;
147
+ outline: none;
148
+ }
149
+ .uib-raw:focus { border-color: var(--uib-accent); }
150
+ .uib-raw[aria-invalid="true"] { border-color: var(--uib-danger); }
151
+ .uib-panel-error { color: #ff8a80; }
152
+ .uib-area { flex: 1; min-height: 0; overflow: auto; position: relative; }
153
+ .uib-area[data-framed="true"] { background: var(--uib-surround); }
154
+ .uib-stage-padded { padding: 24px; }
155
+ .uib-stage-full { display: flex; flex-direction: column; min-height: 100%; }
156
+ .uib-error { color: var(--uib-danger); white-space: pre-wrap; margin: 0; font: inherit; }
157
+ .uib-dim { color: var(--uib-stage-dim); }
158
+ .uib-frame-area {
159
+ min-width: min-content;
160
+ min-height: 100%;
161
+ display: flex;
162
+ flex-direction: column;
163
+ align-items: center;
164
+ gap: 8px;
165
+ padding: 16px 24px 24px;
166
+ }
167
+ .uib-frame-label { display: flex; align-items: center; gap: 6px; min-height: 20px; color: var(--uib-bar-dim); }
168
+ .uib-size {
169
+ width: 6ch;
170
+ height: 20px;
171
+ margin: 0;
172
+ padding: 0 4px;
173
+ border: 1px solid var(--uib-bar-line);
174
+ border-radius: 0;
175
+ background: transparent;
176
+ color: var(--uib-bar-fg);
177
+ font: inherit;
178
+ text-align: center;
179
+ outline: none;
180
+ }
181
+ .uib-size:hover, .uib-size:focus { border-color: var(--uib-accent); }
182
+ .uib-frame { flex: none; box-sizing: content-box; border: 1px solid var(--uib-bar-line); background: var(--uib-stage); }
183
+ .uib-resizer {
184
+ flex: none;
185
+ display: grid;
186
+ grid-template-columns: auto 12px;
187
+ grid-template-rows: auto 12px;
188
+ margin-left: 12px;
189
+ }
190
+ .uib-resizer[data-dragging] .uib-frame { pointer-events: none; }
191
+ .uib-handle { position: relative; background: var(--uib-bar-line); touch-action: none; outline: none; }
192
+ .uib-handle:hover, .uib-handle:focus-visible, .uib-handle[data-active] { background: var(--uib-accent); }
193
+ .uib-handle::after { content: ""; position: absolute; inset: 0; margin: auto; background: var(--uib-bar); }
194
+ .uib-handle-x { cursor: ew-resize; }
195
+ .uib-handle-x::after { width: 2px; height: 32px; }
196
+ .uib-handle-y { cursor: ns-resize; }
197
+ .uib-handle-y::after { width: 32px; height: 2px; }
198
+ .uib-handle-xy { cursor: nwse-resize; }
199
+ .uib-handle-xy::after { width: 4px; height: 4px; }
200
+ .uib-readout {
201
+ position: fixed;
202
+ z-index: 3;
203
+ padding: 2px 6px;
204
+ background: var(--uib-bar);
205
+ color: var(--uib-bar-fg);
206
+ border: 1px solid var(--uib-accent);
207
+ white-space: nowrap;
208
+ pointer-events: none;
209
+ opacity: 0;
210
+ transition: opacity 0.25s;
211
+ }
212
+ .uib-readout[data-shown] { opacity: 1; transition-duration: 0.08s; }
213
+ .uib-landing { max-width: 560px; margin: 0 auto; padding: 48px 24px; }
214
+ .uib-landing h1 { margin: 0 0 4px; font: inherit; font-weight: 700; }
215
+ .uib-landing p { margin: 0 0 24px; color: var(--uib-stage-dim); }
216
+ .uib-landing h2 { margin: 16px 0 4px; font: inherit; color: var(--uib-stage-dim); }
217
+ .uib-landing code { font: inherit; color: var(--uib-stage-fg); }
218
+ .uib-link {
219
+ appearance: none;
220
+ display: block;
221
+ margin: 0;
222
+ padding: 3px 0;
223
+ border: 0;
224
+ background: transparent;
225
+ color: inherit;
226
+ font: inherit;
227
+ text-align: left;
228
+ cursor: pointer;
229
+ }
230
+ .uib-link:hover, .uib-link:focus-visible { text-decoration: underline; outline: none; }
231
+ .uib-restore { position: absolute; right: 0; z-index: 2; background: var(--uib-bar); color: var(--uib-bar-fg); padding: 4px; display: flex; align-items: center; }
232
+ .uib-root[data-edge="bottom"] .uib-restore { bottom: 24px; }
233
+ .uib-root[data-edge="top"] .uib-restore { top: 24px; }
234
+ `;
235
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/dom/styles.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,GAAG,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyOlB,CAAC"}
@@ -0,0 +1,8 @@
1
+ export { UiBench } from "./UiBench";
2
+ export { uiBenchRequested, type UiBenchRequest } from "./core/entry";
3
+ export { fromRequireContext, type Fixture, type FixtureLayout, type FixtureModules, type FixtureSeed } from "./core/fixtures";
4
+ export type { InputDeclarations, InputOptions, InputValues, InputsOf } from "./core/inputs";
5
+ export type { BarEdge, BenchStorage, ThemeMode } from "./core/prefs";
6
+ export type { UiBenchProps, WrapperProps } from "./core/props";
7
+ export { useHarness, useInputs, useSeeded, type Harness } from "./core/stage";
8
+ export { DEFAULT_VIEWPORTS, type Viewport, type Viewports } from "./core/viewports";
@@ -0,0 +1,6 @@
1
+ export { UiBench } from "./UiBench";
2
+ export { uiBenchRequested } from "./core/entry";
3
+ export { fromRequireContext } from "./core/fixtures";
4
+ export { useHarness, useInputs, useSeeded } from "./core/stage";
5
+ export { DEFAULT_VIEWPORTS } from "./core/viewports";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAuB,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAA2E,MAAM,iBAAiB,CAAC;AAI9H,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAgB,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAiC,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from "react";
2
+ export declare function Box({ label, onPress, children, active, accent, disabled, testID, }: {
3
+ label: string;
4
+ onPress: () => void;
5
+ children: ReactNode;
6
+ active?: boolean;
7
+ accent?: boolean;
8
+ disabled?: boolean;
9
+ testID?: string;
10
+ }): import("react").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Pressable, StyleSheet, Text } from "react-native";
3
+ import { bar, mono } from "./theme";
4
+ export function Box({ label, onPress, children, active = false, accent = false, disabled = false, testID, }) {
5
+ return (_jsx(Pressable, { onPress: onPress, disabled: disabled, hitSlop: 6, role: "button", accessibilityLabel: label, testID: testID, style: [styles.box, (active || accent) && styles.active, disabled && styles.disabled], children: typeof children === "string" ? (_jsx(Text, { style: [styles.text, (active || accent) && styles.activeText], numberOfLines: 1, children: children })) : (children) }));
6
+ }
7
+ const styles = StyleSheet.create({
8
+ box: {
9
+ height: 24,
10
+ paddingHorizontal: 8,
11
+ justifyContent: "center",
12
+ borderWidth: 1,
13
+ borderColor: bar.line,
14
+ flexShrink: 1,
15
+ },
16
+ active: { borderColor: bar.accent },
17
+ disabled: { opacity: 0.4 },
18
+ text: { ...mono, color: bar.text },
19
+ activeText: { color: bar.accent },
20
+ });
21
+ //# sourceMappingURL=Box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Box.js","sourceRoot":"","sources":["../../../src/native/Box.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAE3D,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,UAAU,GAAG,CAAC,EAClB,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,GAAG,KAAK,EACd,MAAM,GAAG,KAAK,EACd,QAAQ,GAAG,KAAK,EAChB,MAAM,GASP;IACC,OAAO,CACL,KAAC,SAAS,IACR,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,CAAC,EACV,IAAI,EAAC,QAAQ,EACb,kBAAkB,EAAE,KAAK,EACzB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,YAEpF,OAAO,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAC9B,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,MAAM,CAAC,UAAU,CAAC,EAAE,aAAa,EAAE,CAAC,YAClF,QAAQ,GACJ,CACR,CAAC,CAAC,CAAC,CACF,QAAQ,CACT,GACS,CACb,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,GAAG,EAAE;QACH,MAAM,EAAE,EAAE;QACV,iBAAiB,EAAE,CAAC;QACpB,cAAc,EAAE,QAAQ;QACxB,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,GAAG,CAAC,IAAI;QACrB,UAAU,EAAE,CAAC;KACd;IACD,MAAM,EAAE,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE;IACnC,QAAQ,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE;IAC1B,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE;IAClC,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE;CAClC,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { BenchController } from "../core/controller";
2
+ export declare function ControlBar({ bench, inset }: {
3
+ bench: BenchController;
4
+ inset: number;
5
+ }): import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { StyleSheet, Text, useWindowDimensions, View } from "react-native";
3
+ import { Box } from "./Box";
4
+ import { FixturePicker } from "./FixturePicker";
5
+ import { Triangle } from "./Triangle";
6
+ import { bar, mono } from "./theme";
7
+ export function ControlBar({ bench, inset }) {
8
+ const { prefs, updatePrefs, mode } = bench;
9
+ const { width } = useWindowDimensions();
10
+ return (_jsxs(View, { style: [styles.bar, prefs.edge === "top" ? { paddingTop: 4 + inset } : { paddingBottom: 4 + inset }], testID: "control-bar", children: [_jsx(Text, { style: styles.mark, children: width > 560 ? "UI Bench" : "UI" }), _jsx(FixturePicker, { fixtures: bench.fixtures, selected: bench.selected, onSelect: bench.select }), _jsx(View, { style: styles.spacer }), _jsx(Box, { label: "Show or hide the inputs", active: prefs.inputsOpen, onPress: () => updatePrefs({ inputsOpen: !prefs.inputsOpen }), testID: "toggle-inputs", children: "inputs" }), bench.canReseed ? (_jsx(Box, { label: "Reseed the fixture", onPress: bench.reseed, testID: "reseed", children: "reseed" })) : null, _jsx(Box, { label: mode === "light" ? "Switch to dark theme" : "Switch to light theme", onPress: bench.toggleTheme, testID: "toggle-theme", children: mode === "light" ? "dark" : "light" }), _jsx(Box, { label: prefs.edge === "bottom" ? "Move control bar to top" : "Move control bar to bottom", onPress: () => updatePrefs({ edge: prefs.edge === "bottom" ? "top" : "bottom" }), testID: "bar-flip", children: _jsx(Triangle, { up: prefs.edge === "bottom", color: bar.text }) }), _jsx(Box, { accent: true, label: "Minimise control bar", onPress: () => updatePrefs({ minimised: true }), testID: "bar-minimise", children: "\u2212" })] }));
11
+ }
12
+ const styles = StyleSheet.create({
13
+ bar: {
14
+ flexDirection: "row",
15
+ alignItems: "center",
16
+ gap: 8,
17
+ paddingHorizontal: 8,
18
+ paddingVertical: 4,
19
+ backgroundColor: bar.background,
20
+ },
21
+ mark: { ...mono, color: bar.accent, fontWeight: "700" },
22
+ spacer: { flex: 1 },
23
+ });
24
+ //# sourceMappingURL=ControlBar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ControlBar.js","sourceRoot":"","sources":["../../../src/native/ControlBar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAG3E,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,UAAU,UAAU,CAAC,EAAE,KAAK,EAAE,KAAK,EAA6C;IACpF,MAAM,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAC3C,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AO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,GAChC,EACN,KAAC,GAAG,IACF,KAAK,EAAE,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,4BAA4B,EACzF,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,EAChF,MAAM,EAAC,UAAU,YAEjB,KAAC,QAAQ,IAAC,EAAE,EAAE,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,GAAI,GACtD,EACN,KAAC,GAAG,IAAC,MAAM,QAAC,KAAK,EAAC,sBAAsB,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAC,cAAc,uBAEzG,IACD,CACR,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,GAAG,EAAE;QACH,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,GAAG,EAAE,CAAC;QACN,iBAAiB,EAAE,CAAC;QACpB,eAAe,EAAE,CAAC;QAClB,eAAe,EAAE,GAAG,CAAC,UAAU;KAChC;IACD,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE;IACvD,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;CACpB,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { type Fixture } from "../core/fixtures";
2
+ export declare function FixturePicker({ fixtures, selected, onSelect, }: {
3
+ fixtures: Fixture[];
4
+ selected: Fixture | null;
5
+ onSelect: (id: string) => void;
6
+ }): import("react").JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo, useState } from "react";
3
+ import { Modal, Pressable, ScrollView, StyleSheet, Text, TextInput, View } from "react-native";
4
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
5
+ import { groupByFile, searchFixtures } from "../core/fixtures";
6
+ import { Box } from "./Box";
7
+ import { bar, mono } from "./theme";
8
+ export function FixturePicker({ fixtures, selected, onSelect, }) {
9
+ const [open, setOpen] = useState(false);
10
+ const [query, setQuery] = useState("");
11
+ const insets = useSafeAreaInsets();
12
+ const groups = useMemo(() => groupByFile(searchFixtures(fixtures, query)), [fixtures, query]);
13
+ const close = () => {
14
+ setOpen(false);
15
+ setQuery("");
16
+ };
17
+ return (_jsxs(_Fragment, { children: [_jsx(Box, { label: "Pick a fixture", onPress: () => setOpen(true), testID: "fixture-picker", children: selected ? selected.label : "Pick a fixture" }), _jsx(Modal, { visible: open, animationType: "slide", onRequestClose: close, children: _jsxs(View, { style: [styles.sheet, { paddingTop: insets.top, paddingBottom: insets.bottom }], children: [_jsxs(View, { style: styles.head, children: [_jsx(TextInput, { style: styles.search, value: query, onChangeText: setQuery, placeholder: "Search fixtures", placeholderTextColor: bar.dim, autoFocus: true, autoCapitalize: "none", autoCorrect: false, accessibilityLabel: "Search fixtures", testID: "fixture-search" }), _jsx(Box, { label: "Close the fixture list", onPress: close, testID: "fixture-close", children: "close" })] }), _jsxs(ScrollView, { keyboardShouldPersistTaps: "handled", contentContainerStyle: styles.list, children: [groups.map(([file, items]) => (_jsxs(View, { children: [_jsx(Text, { style: styles.group, children: file }), items.map((fixture) => (_jsx(Pressable, { role: "button", accessibilityLabel: fixture.label, testID: `fixture:${fixture.id}`, style: styles.option, onPress: () => {
18
+ onSelect(fixture.id);
19
+ close();
20
+ }, children: _jsx(Text, { style: [styles.optionText, fixture.id === selected?.id && styles.current], children: fixture.name }) }, fixture.id)))] }, file))), groups.length === 0 ? _jsx(Text, { style: styles.group, children: "No fixtures match." }) : null] })] }) })] }));
21
+ }
22
+ const styles = StyleSheet.create({
23
+ sheet: { flex: 1, backgroundColor: bar.background },
24
+ head: {
25
+ flexDirection: "row",
26
+ alignItems: "center",
27
+ gap: 8,
28
+ padding: 8,
29
+ borderBottomWidth: 1,
30
+ borderBottomColor: bar.line,
31
+ },
32
+ search: { ...mono, flex: 1, height: 32, padding: 0, color: bar.text },
33
+ list: { paddingVertical: 4 },
34
+ group: { ...mono, color: bar.dim, paddingHorizontal: 12, paddingTop: 12, paddingBottom: 2 },
35
+ option: { paddingHorizontal: 24, paddingVertical: 10 },
36
+ optionText: { ...mono, color: bar.text },
37
+ current: { color: bar.accent },
38
+ });
39
+ //# sourceMappingURL=FixturePicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FixturePicker.js","sourceRoot":"","sources":["../../../src/native/FixturePicker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAgB,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,UAAU,aAAa,CAAC,EAC5B,QAAQ,EACR,QAAQ,EACR,QAAQ,GAKT;IACC,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAA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E,QAAQ;QACpB,GAAG,EAAE,CAAC;QACN,OAAO,EAAE,CAAC;QACV,iBAAiB,EAAE,CAAC;QACpB,iBAAiB,EAAE,GAAG,CAAC,IAAI;KAC5B;IACD,MAAM,EAAE,EAAE,GAAG,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE;IACrE,IAAI,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE;IAC5B,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,EAAE,iBAAiB,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE;IAC3F,MAAM,EAAE,EAAE,iBAAiB,EAAE,EAAE,EAAE,eAAe,EAAE,EAAE,EAAE;IACtD,UAAU,EAAE,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE;IACxC,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE;CAC/B,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type InputValues } from "../core/inputs";
2
+ export declare function InputsPanel({ values, changed, onChange, onReset, }: {
3
+ values: InputValues;
4
+ changed: boolean;
5
+ onChange: (values: InputValues) => void;
6
+ onReset: () => void;
7
+ }): import("react").JSX.Element;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useState } from "react";
3
+ import { StyleSheet, Text, TextInput, View } from "react-native";
4
+ import { formatRawInputs, parseRawInputs } from "../core/inputs";
5
+ import { Box } from "./Box";
6
+ import { bar, mono } from "./theme";
7
+ export function InputsPanel({ values, changed, onChange, onReset, }) {
8
+ const canonical = JSON.stringify(values);
9
+ const [text, setText] = useState(() => formatRawInputs(values));
10
+ const parsed = parseRawInputs(text);
11
+ useEffect(() => {
12
+ setText((current) => {
13
+ const typed = parseRawInputs(current);
14
+ return typed.ok && JSON.stringify(typed.values) === canonical ? current : formatRawInputs(JSON.parse(canonical));
15
+ });
16
+ }, [canonical]);
17
+ return (_jsxs(View, { style: styles.panel, testID: "inputs-panel", children: [_jsxs(View, { style: styles.head, children: [_jsx(Text, { style: styles.title, children: "inputs" }), _jsx(Text, { style: styles.error, numberOfLines: 1, testID: "inputs-error", children: parsed.ok ? "" : parsed.message }), _jsx(Box, { label: "Reset the inputs", onPress: onReset, disabled: !changed, testID: "inputs-reset", children: "reset" })] }), _jsx(TextInput, { style: [styles.raw, !parsed.ok && styles.invalid], value: text, multiline: true, autoCapitalize: "none", autoCorrect: false, spellCheck: false, accessibilityLabel: "Fixture inputs as JSON", testID: "inputs-raw", onChangeText: (next) => {
18
+ setText(next);
19
+ const typed = parseRawInputs(next);
20
+ if (typed.ok)
21
+ onChange(typed.values);
22
+ } })] }));
23
+ }
24
+ const styles = StyleSheet.create({
25
+ panel: { gap: 6, padding: 8, backgroundColor: bar.background, borderColor: bar.line, borderTopWidth: 1, borderBottomWidth: 1 },
26
+ head: { flexDirection: "row", alignItems: "center", gap: 8 },
27
+ title: { ...mono, color: bar.dim },
28
+ error: { ...mono, flex: 1, color: bar.danger },
29
+ raw: {
30
+ ...mono,
31
+ minHeight: 96,
32
+ maxHeight: 200,
33
+ padding: 8,
34
+ borderWidth: 1,
35
+ borderColor: bar.line,
36
+ color: bar.text,
37
+ textAlignVertical: "top",
38
+ },
39
+ invalid: { borderColor: bar.danger },
40
+ });
41
+ //# sourceMappingURL=InputsPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"InputsPanel.js","sourceRoot":"","sources":["../../../src/native/InputsPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC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E,GAAG,CAAC,MAAM,EAAE;IAC9C,GAAG,EAAE;QACH,GAAG,IAAI;QACP,SAAS,EAAE,EAAE;QACb,SAAS,EAAE,GAAG;QACd,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,CAAC;QACd,WAAW,EAAE,GAAG,CAAC,IAAI;QACrB,KAAK,EAAE,GAAG,CAAC,IAAI;QACf,iBAAiB,EAAE,KAAK;KACzB;IACD,OAAO,EAAE,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE;CACrC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type Fixture } from "../core/fixtures";
2
+ import { type StagePalette } from "./theme";
3
+ export declare function Landing({ fixtures, missing, palette, onSelect, }: {
4
+ fixtures: Fixture[];
5
+ missing: string | null;
6
+ palette: StagePalette;
7
+ onSelect: (id: string) => void;
8
+ }): import("react").JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Pressable, StyleSheet, Text, View } from "react-native";
3
+ import { groupByFile } from "../core/fixtures";
4
+ import { mono } from "./theme";
5
+ export function Landing({ fixtures, missing, palette, onSelect, }) {
6
+ const text = { color: palette.text };
7
+ const dim = { color: palette.dim };
8
+ return (_jsxs(View, { testID: "landing", children: [_jsx(Text, { style: [styles.title, text], children: "UI bench" }), _jsx(Text, { style: [styles.line, dim], children: missing
9
+ ? `No fixture is called ${missing}.`
10
+ : fixtures.length === 0
11
+ ? "No fixtures yet. Add a Name.fixture.tsx beside a component, with the component (or an object of named variants) as its default export."
12
+ : `${fixtures.length} ${fixtures.length === 1 ? "fixture" : "fixtures"}. Pick one to render it on its own.` }), groupByFile(fixtures).map(([file, items]) => (_jsxs(View, { style: styles.group, children: [_jsx(Text, { style: [styles.line, dim], children: file }), items.map((fixture) => (_jsx(Pressable, { role: "button", accessibilityLabel: fixture.label, testID: `landing:${fixture.id}`, style: styles.link, onPress: () => onSelect(fixture.id), children: _jsx(Text, { style: [styles.line, text], children: fixture.name }) }, fixture.id)))] }, file)))] }));
13
+ }
14
+ const styles = StyleSheet.create({
15
+ title: { ...mono, fontWeight: "700", marginBottom: 4 },
16
+ line: { ...mono },
17
+ group: { marginTop: 16 },
18
+ link: { paddingVertical: 8 },
19
+ });
20
+ //# sourceMappingURL=Landing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Landing.js","sourceRoot":"","sources":["../../../src/native/Landing.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAqB,MAAM,SAAS,CAAC;AAElD,MAAM,UAAU,OAAO,CAAC,EACtB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,QAAQ,GAMT;IACC,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;IACrC,MAAM,GAAG,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;IACnC,OAAO,CACL,MAAC,IAAI,IAAC,MAAM,EAAC,SAAS,aACpB,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,yBAAiB,EAClD,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,YAC5B,OAAO;oBACN,CAAC,CAAC,wBAAwB,OAAO,GAAG;oBACpC,CAAC,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;wBACrB,CAAC,CAAC,wIAAwI;wBAC1I,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,qCAAqC,GAC1G,EACN,WAAW,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAC5C,MAAC,IAAI,IAAY,KAAK,EAAE,MAAM,CAAC,KAAK,aAClC,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,YAAG,IAAI,GAAQ,EAC7C,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CACtB,KAAC,SAAS,IAER,IAAI,EAAC,QAAQ,EACb,kBAAkB,EAAE,OAAO,CAAC,KAAK,EACjC,MAAM,EAAE,WAAW,OAAO,CAAC,EAAE,EAAE,EAC/B,KAAK,EAAE,MAAM,CAAC,IAAI,EAClB,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,YAEnC,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,YAAG,OAAO,CAAC,IAAI,GAAQ,IAPlD,OAAO,CAAC,EAAE,CAQL,CACb,CAAC,KAbO,IAAI,CAcR,CACR,CAAC,IACG,CACR,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,EAAE;IACtD,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE;IACjB,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACxB,IAAI,EAAE,EAAE,eAAe,EAAE,CAAC,EAAE;CAC7B,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function Triangle({ up, color }: {
2
+ up: boolean;
3
+ color: string;
4
+ }): import("react").JSX.Element;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { StyleSheet, View } from "react-native";
3
+ export function Triangle({ up, color }) {
4
+ const point = up ? { borderBottomWidth: 5, borderBottomColor: color } : { borderTopWidth: 5, borderTopColor: color };
5
+ return _jsx(View, { style: [styles.triangle, point] });
6
+ }
7
+ const styles = StyleSheet.create({
8
+ triangle: {
9
+ width: 0,
10
+ height: 0,
11
+ borderLeftWidth: 4,
12
+ borderRightWidth: 4,
13
+ borderLeftColor: "transparent",
14
+ borderRightColor: "transparent",
15
+ },
16
+ });
17
+ //# sourceMappingURL=Triangle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Triangle.js","sourceRoot":"","sources":["../../../src/native/Triangle.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEhD,MAAM,UAAU,QAAQ,CAAC,EAAE,EAAE,EAAE,KAAK,EAAkC;IACpE,MAAM,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC;IACrH,OAAO,KAAC,IAAI,IAAC,KAAK,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,KAAK,CAAC,GAAI,CAAC;AACnD,CAAC;AAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,QAAQ,EAAE;QACR,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,CAAC;QACT,eAAe,EAAE,CAAC;QAClB,gBAAgB,EAAE,CAAC;QACnB,eAAe,EAAE,aAAa;QAC9B,gBAAgB,EAAE,aAAa;KAChC;CACF,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { type TextStyle } from "react-native";
2
+ import type { ThemeMode } from "../core/prefs";
3
+ export declare const bar: {
4
+ background: string;
5
+ text: string;
6
+ dim: string;
7
+ line: string;
8
+ accent: string;
9
+ danger: string;
10
+ };
11
+ export type StagePalette = {
12
+ background: string;
13
+ text: string;
14
+ dim: string;
15
+ danger: string;
16
+ };
17
+ export declare const stage: Record<ThemeMode, StagePalette>;
18
+ export declare const mono: TextStyle;
@@ -0,0 +1,19 @@
1
+ import { Platform } from "react-native";
2
+ export const bar = {
3
+ background: "#050505",
4
+ text: "#f4f4f4",
5
+ dim: "#a8a8a8",
6
+ line: "#3d3d3d",
7
+ accent: "#ff8844",
8
+ danger: "#ff8a80",
9
+ };
10
+ export const stage = {
11
+ light: { background: "#ffffff", text: "#16181d", dim: "#6b7280", danger: "#c62828" },
12
+ dark: { background: "#101216", text: "#eceef2", dim: "#8b93a3", danger: "#ff8a80" },
13
+ };
14
+ export const mono = {
15
+ fontFamily: Platform.select({ ios: "Menlo", default: "monospace" }),
16
+ fontSize: 12,
17
+ lineHeight: 16,
18
+ };
19
+ //# sourceMappingURL=theme.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme.js","sourceRoot":"","sources":["../../../src/native/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,cAAc,CAAC;AAIxD,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,SAAS;IACd,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;CAClB,CAAC;AAIF,MAAM,CAAC,MAAM,KAAK,GAAoC;IACpD,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE;IACpF,IAAI,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE;CACpF,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAc;IAC7B,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;IACnE,QAAQ,EAAE,EAAE;IACZ,UAAU,EAAE,EAAE;CACf,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type ComponentType, type ReactElement } from "react";
2
+ import { type Fixture, type FixtureModules } from "../core/fixtures";
3
+ import type { ThemeMode } from "../core/prefs";
4
+ import type { WrapperProps } from "../core/props";
5
+ import { type Harness } from "../core/stage";
6
+ export type FixtureCase = {
7
+ id: string;
8
+ fixture: Fixture;
9
+ /** Seeds the fixture, then returns it ready to render with its default inputs. */
10
+ mount(): Promise<ReactElement>;
11
+ };
12
+ export type FixtureCaseOptions = {
13
+ fixtures: FixtureModules;
14
+ harness?: Harness<any>;
15
+ wrapper?: ComponentType<WrapperProps>;
16
+ mode?: ThemeMode;
17
+ };
18
+ /** One case per fixture, for `it.each`. Rendering a fixture that throws fails its test. */
19
+ export declare function fixtureCases({ fixtures, harness, wrapper, mode }: FixtureCaseOptions): FixtureCase[];
20
+ /** For a runner with no `import.meta.glob` or `require.context` (Jest): the test finds and loads the files. */
21
+ export declare function fixturesFromFiles(files: string[], load: (file: string) => unknown): FixtureModules;
@@ -0,0 +1,33 @@
1
+ import { createElement } from "react";
2
+ import { loadFixtures } from "../core/fixtures";
3
+ import { defaultInputs } from "../core/inputs";
4
+ import { StageBody, createHarnessSession } from "../core/stage";
5
+ /** One case per fixture, for `it.each`. Rendering a fixture that throws fails its test. */
6
+ export function fixtureCases({ fixtures, harness, wrapper, mode = "light" }) {
7
+ const session = createHarnessSession(() => harness);
8
+ return loadFixtures(fixtures).map((fixture) => ({
9
+ id: fixture.id,
10
+ fixture,
11
+ async mount() {
12
+ const prepared = await session.prepare(fixture);
13
+ return createElement(StageBody, {
14
+ stage: { kind: "ready", fixture, key: fixture.id, prepared },
15
+ inputs: defaultInputs(fixture.inputs),
16
+ mode,
17
+ wrapper,
18
+ renderLoading: () => null,
19
+ renderError: (message) => {
20
+ throw new Error(`${fixture.id}: ${message}`);
21
+ },
22
+ });
23
+ },
24
+ }));
25
+ }
26
+ /** For a runner with no `import.meta.glob` or `require.context` (Jest): the test finds and loads the files. */
27
+ export function fixturesFromFiles(files, load) {
28
+ const modules = {};
29
+ for (const file of files)
30
+ modules[file.replace(/\\/g, "/")] = load(file);
31
+ return modules;
32
+ }
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAyC,MAAM,OAAO,CAAC;AAE7E,OAAO,EAAE,YAAY,EAAqC,MAAM,kBAAkB,CAAC;AACnF,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAG/C,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAgB,MAAM,eAAe,CAAC;AAgB9E,2FAA2F;AAC3F,MAAM,UAAU,YAAY,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,GAAG,OAAO,EAAsB;IAC7F,MAAM,OAAO,GAAG,oBAAoB,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC;IACpD,OAAO,YAAY,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC9C,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,OAAO;QACP,KAAK,CAAC,KAAK;YACT,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAChD,OAAO,aAAa,CAAC,SAAS,EAAE;gBAC9B,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE;gBAC5D,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC;gBACrC,IAAI;gBACJ,OAAO;gBACP,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI;gBACzB,WAAW,E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