@hanzo/ui 8.0.60 → 8.0.61
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/dist/backends/gui/switch.cjs +2 -16
- package/dist/backends/gui/switch.d.ts +0 -14
- package/dist/backends/gui/switch.d.ts.map +1 -1
- package/dist/backends/gui/switch.js +2 -16
- package/dist/backends/gui/switch.js.map +1 -1
- package/dist/product/index.cjs +0 -7
- package/dist/product/index.d.ts +0 -3
- package/dist/product/index.d.ts.map +1 -1
- package/dist/product/index.js +0 -7
- package/dist/product/index.js.map +1 -1
- package/dist/styles.css +11 -9
- package/dist/theme.css +9 -9
- package/package.json +5 -5
- package/dist/product/Palette.cjs +0 -65
- package/dist/product/Palette.d.ts +0 -67
- package/dist/product/Palette.d.ts.map +0 -1
- package/dist/product/Palette.js +0 -63
- package/dist/product/Palette.js.map +0 -1
- package/dist/product/match.cjs +0 -76
- package/dist/product/match.d.ts +0 -78
- package/dist/product/match.d.ts.map +0 -1
- package/dist/product/match.js +0 -72
- package/dist/product/match.js.map +0 -1
- package/dist/product/useCommandK.cjs +0 -46
- package/dist/product/useCommandK.d.ts +0 -4
- package/dist/product/useCommandK.d.ts.map +0 -1
- package/dist/product/useCommandK.js +0 -44
- package/dist/product/useCommandK.js.map +0 -1
|
@@ -28,20 +28,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
28
28
|
* with no signal in it — which is what a full page of these actually looked
|
|
29
29
|
* like. Off is muted, on is filled, and the loudest treatment is the one that
|
|
30
30
|
* means something.
|
|
31
|
-
*
|
|
32
|
-
* THE THUMB TAKES THE SAME TOKEN AS ITS TRACK, and that is not a copy-paste
|
|
33
|
-
* slip. gui wraps the thumb in a `t_SwitchThumb` sub-theme that INVERTS the
|
|
34
|
-
* whole ramp — measured live, `$color3` is rgb(26,26,26) at the frame and
|
|
35
|
-
* rgb(171,171,171) inside the thumb; `$color12` is rgb(250,250,250) and
|
|
36
|
-
* rgb(10,10,10). So naming one token paints both sides of the pair and the
|
|
37
|
-
* contrast is structural: the thumb cannot come out the same colour as the
|
|
38
|
-
* track it sits on, in either state, whatever the palette does later.
|
|
39
|
-
*
|
|
40
|
-
* Picking the tokens by eye instead shipped once, in 8.0.57-8.0.59, and it
|
|
41
|
-
* shipped INVISIBLE: `$color10` under the thumb resolved to the off track's own
|
|
42
|
-
* rgb(26,26,26) and `$color1` to the on track's rgb(255,255,255). The tests
|
|
43
|
-
* passed, because they asked whether the two states DIFFER from each other and
|
|
44
|
-
* never whether either one differs from the thing behind it.
|
|
45
31
|
*/
|
|
46
32
|
const gui_1 = require("@hanzo/gui");
|
|
47
33
|
const slot_1 = require("./slot.cjs");
|
|
@@ -56,7 +42,7 @@ const Switch = ({ disabled, ...props }) => ((0, jsx_runtime_1.jsx)(gui_1.Switch,
|
|
|
56
42
|
// else: a control that ignores its own disabled prop looks identical to a
|
|
57
43
|
// live one, and the page this was found on had a disabled switch sitting
|
|
58
44
|
// beside eight enabled ones with nothing to tell them apart.
|
|
59
|
-
disabled: disabled, opacity: disabled ? 0.5 : 1, cursor: disabled ? 'not-allowed' : 'pointer', ...(0, gesture_1.touch)(TRACK_H, 44, 'y'), ...props, children: (0, jsx_runtime_1.jsx)(gui_1.Switch.Thumb, { ...(0, slot_1.slot)('switch-thumb'), width: THUMB, height: THUMB, backgroundColor: "$
|
|
45
|
+
disabled: disabled, opacity: disabled ? 0.5 : 1, cursor: disabled ? 'not-allowed' : 'pointer', ...(0, gesture_1.touch)(TRACK_H, 44, 'y'), ...props, children: (0, jsx_runtime_1.jsx)(gui_1.Switch.Thumb, { ...(0, slot_1.slot)('switch-thumb'), width: THUMB, height: THUMB, backgroundColor: "$color10",
|
|
60
46
|
// `bg`, and it is the only one of the three spellings that is both typed
|
|
61
47
|
// and correct. The Thumb's activeStyle is typed as the SHORTHAND style set:
|
|
62
48
|
// `backgroundColor` paints but is not in that type; `background` is in it
|
|
@@ -65,5 +51,5 @@ const Switch = ({ disabled, ...props }) => ((0, jsx_runtime_1.jsx)(gui_1.Switch,
|
|
|
65
51
|
// Consumers build with ignoreBuildErrors, so the first would have shipped
|
|
66
52
|
// an error nobody sees and the second a colour that lands or does not
|
|
67
53
|
// depending on stylesheet order.
|
|
68
|
-
activeStyle: { bg: '$
|
|
54
|
+
activeStyle: { bg: '$color1' } }) }));
|
|
69
55
|
exports.Switch = Switch;
|
|
@@ -23,20 +23,6 @@
|
|
|
23
23
|
* with no signal in it — which is what a full page of these actually looked
|
|
24
24
|
* like. Off is muted, on is filled, and the loudest treatment is the one that
|
|
25
25
|
* means something.
|
|
26
|
-
*
|
|
27
|
-
* THE THUMB TAKES THE SAME TOKEN AS ITS TRACK, and that is not a copy-paste
|
|
28
|
-
* slip. gui wraps the thumb in a `t_SwitchThumb` sub-theme that INVERTS the
|
|
29
|
-
* whole ramp — measured live, `$color3` is rgb(26,26,26) at the frame and
|
|
30
|
-
* rgb(171,171,171) inside the thumb; `$color12` is rgb(250,250,250) and
|
|
31
|
-
* rgb(10,10,10). So naming one token paints both sides of the pair and the
|
|
32
|
-
* contrast is structural: the thumb cannot come out the same colour as the
|
|
33
|
-
* track it sits on, in either state, whatever the palette does later.
|
|
34
|
-
*
|
|
35
|
-
* Picking the tokens by eye instead shipped once, in 8.0.57-8.0.59, and it
|
|
36
|
-
* shipped INVISIBLE: `$color10` under the thumb resolved to the off track's own
|
|
37
|
-
* rgb(26,26,26) and `$color1` to the on track's rgb(255,255,255). The tests
|
|
38
|
-
* passed, because they asked whether the two states DIFFER from each other and
|
|
39
|
-
* never whether either one differs from the thing behind it.
|
|
40
26
|
*/
|
|
41
27
|
import { Switch as GuiSwitch } from '@hanzo/gui';
|
|
42
28
|
import type { ComponentProps } from 'react';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/switch.tsx"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/backends/gui/switch.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAQ3C,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,SAAS,CAAC,CAAA;AAE1D,QAAA,MAAM,MAAM,GAAI,wBAAwB,WAAW,4CAuClD,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
|
@@ -25,20 +25,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
25
25
|
* with no signal in it — which is what a full page of these actually looked
|
|
26
26
|
* like. Off is muted, on is filled, and the loudest treatment is the one that
|
|
27
27
|
* means something.
|
|
28
|
-
*
|
|
29
|
-
* THE THUMB TAKES THE SAME TOKEN AS ITS TRACK, and that is not a copy-paste
|
|
30
|
-
* slip. gui wraps the thumb in a `t_SwitchThumb` sub-theme that INVERTS the
|
|
31
|
-
* whole ramp — measured live, `$color3` is rgb(26,26,26) at the frame and
|
|
32
|
-
* rgb(171,171,171) inside the thumb; `$color12` is rgb(250,250,250) and
|
|
33
|
-
* rgb(10,10,10). So naming one token paints both sides of the pair and the
|
|
34
|
-
* contrast is structural: the thumb cannot come out the same colour as the
|
|
35
|
-
* track it sits on, in either state, whatever the palette does later.
|
|
36
|
-
*
|
|
37
|
-
* Picking the tokens by eye instead shipped once, in 8.0.57-8.0.59, and it
|
|
38
|
-
* shipped INVISIBLE: `$color10` under the thumb resolved to the off track's own
|
|
39
|
-
* rgb(26,26,26) and `$color1` to the on track's rgb(255,255,255). The tests
|
|
40
|
-
* passed, because they asked whether the two states DIFFER from each other and
|
|
41
|
-
* never whether either one differs from the thing behind it.
|
|
42
28
|
*/
|
|
43
29
|
import { Switch as GuiSwitch } from '@hanzo/gui';
|
|
44
30
|
import { slot } from './slot.js';
|
|
@@ -53,7 +39,7 @@ const Switch = ({ disabled, ...props }) => (_jsx(GuiSwitch, { ...slot('switch'),
|
|
|
53
39
|
// else: a control that ignores its own disabled prop looks identical to a
|
|
54
40
|
// live one, and the page this was found on had a disabled switch sitting
|
|
55
41
|
// beside eight enabled ones with nothing to tell them apart.
|
|
56
|
-
disabled: disabled, opacity: disabled ? 0.5 : 1, cursor: disabled ? 'not-allowed' : 'pointer', ...touch(TRACK_H, 44, 'y'), ...props, children: _jsx(GuiSwitch.Thumb, { ...slot('switch-thumb'), width: THUMB, height: THUMB, backgroundColor: "$
|
|
42
|
+
disabled: disabled, opacity: disabled ? 0.5 : 1, cursor: disabled ? 'not-allowed' : 'pointer', ...touch(TRACK_H, 44, 'y'), ...props, children: _jsx(GuiSwitch.Thumb, { ...slot('switch-thumb'), width: THUMB, height: THUMB, backgroundColor: "$color10",
|
|
57
43
|
// `bg`, and it is the only one of the three spellings that is both typed
|
|
58
44
|
// and correct. The Thumb's activeStyle is typed as the SHORTHAND style set:
|
|
59
45
|
// `backgroundColor` paints but is not in that type; `background` is in it
|
|
@@ -62,6 +48,6 @@ const Switch = ({ disabled, ...props }) => (_jsx(GuiSwitch, { ...slot('switch'),
|
|
|
62
48
|
// Consumers build with ignoreBuildErrors, so the first would have shipped
|
|
63
49
|
// an error nobody sees and the second a colour that lands or does not
|
|
64
50
|
// depending on stylesheet order.
|
|
65
|
-
activeStyle: { bg: '$
|
|
51
|
+
activeStyle: { bg: '$color1' } }) }));
|
|
66
52
|
export { Switch };
|
|
67
53
|
//# sourceMappingURL=switch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/backends/gui/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/backends/gui/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;GA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;QACjC,WAAW,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,GAC9B,GACQ,CACb,CAAA;AAED,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
package/dist/product/index.cjs
CHANGED
|
@@ -111,13 +111,6 @@ __exportStar(require("./FadeIn.cjs"), exports);
|
|
|
111
111
|
__exportStar(require("./Field.cjs"), exports);
|
|
112
112
|
__exportStar(require("./HanzoMark.cjs"), exports);
|
|
113
113
|
__exportStar(require("./PageHeader.cjs"), exports);
|
|
114
|
-
// Palette — the ONE ⌘K bar, plus its opener. The list it renders is not written
|
|
115
|
-
// down anywhere: cloud publishes `GET /v1/commands`, the fifth projection of the
|
|
116
|
-
// one route table, and a surface passes it in. `match.ts` holds the matching
|
|
117
|
-
// rule (safe methods browse, unsafe methods must be named) as pure functions.
|
|
118
|
-
__exportStar(require("./Palette.cjs"), exports);
|
|
119
|
-
__exportStar(require("./match.cjs"), exports);
|
|
120
|
-
__exportStar(require("./useCommandK.cjs"), exports);
|
|
121
114
|
__exportStar(require("./PrimaryButton.cjs"), exports);
|
|
122
115
|
__exportStar(require("./ProductIcon.cjs"), exports);
|
|
123
116
|
__exportStar(require("./ProviderLogo.cjs"), exports);
|
package/dist/product/index.d.ts
CHANGED
|
@@ -31,9 +31,6 @@ export * from './FadeIn.js';
|
|
|
31
31
|
export * from './Field.js';
|
|
32
32
|
export * from './HanzoMark.js';
|
|
33
33
|
export * from './PageHeader.js';
|
|
34
|
-
export * from './Palette.js';
|
|
35
|
-
export * from './match.js';
|
|
36
|
-
export * from './useCommandK.js';
|
|
37
34
|
export * from './PrimaryButton.js';
|
|
38
35
|
export * from './ProductIcon.js';
|
|
39
36
|
export * from './ProviderLogo.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/product/index.ts"],"names":[],"mappings":"AAaA,cAAc,UAAU,CAAA;AAKxB,OAAO,EACL,MAAM,EACN,aAAa,EACb,SAAS,EACT,SAA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,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAA"}
|
package/dist/product/index.js
CHANGED
|
@@ -82,13 +82,6 @@ export * from './FadeIn.js';
|
|
|
82
82
|
export * from './Field.js';
|
|
83
83
|
export * from './HanzoMark.js';
|
|
84
84
|
export * from './PageHeader.js';
|
|
85
|
-
// Palette — the ONE ⌘K bar, plus its opener. The list it renders is not written
|
|
86
|
-
// down anywhere: cloud publishes `GET /v1/commands`, the fifth projection of the
|
|
87
|
-
// one route table, and a surface passes it in. `match.ts` holds the matching
|
|
88
|
-
// rule (safe methods browse, unsafe methods must be named) as pure functions.
|
|
89
|
-
export * from './Palette.js';
|
|
90
|
-
export * from './match.js';
|
|
91
|
-
export * from './useCommandK.js';
|
|
92
85
|
export * from './PrimaryButton.js';
|
|
93
86
|
export * from './ProductIcon.js';
|
|
94
87
|
export * from './ProviderLogo.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/product/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,EAAE;AACF,2EAA2E;AAC3E,gFAAgF;AAChF,iFAAiF;AACjF,gFAAgF;AAChF,wEAAwE;AACxE,EAAE;AACF,kFAAkF;AAClF,6EAA6E;AAE7E,kFAAkF;AAClF,gEAAgE;AAChE,cAAc,UAAU,CAAA;AAExB,2EAA2E;AAC3E,+EAA+E;AAC/E,4CAA4C;AAC5C,OAAO,EACL,MAAM,EACN,aAAa,EACb,SAAS,EACT,SAAS,IAAI,eAAe,EAC5B,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,EACV,UAAU,EACV,KAAK,GACN,MAAM,UAAU,CAAA;AAEjB,6EAA6E;AAC7E,OAAO,EAAE,KAAK,IAAI,SAAS,EAAqB,MAAM,SAAS,CAAA;AAE/D,+EAA+E;AAC/E,8EAA8E;AAC9E,qCAAqC;AACrC,OAAO,EAAE,QAAQ,EA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,23 @@
|
|
|
231
231
|
silent (the border simply stops existing) and has shipped before. */
|
|
232
232
|
.light, :root.t_light, .t_light{
|
|
233
233
|
color-scheme:light;
|
|
234
|
-
--background:#
|
|
234
|
+
--background:#f7f7f7;
|
|
235
235
|
--foreground:#0a0a0a;
|
|
236
236
|
/* A ladder, not four names for #f5f5f5. Light lifts by the same tiny steps
|
|
237
237
|
dark does — ~2% per rung — so --surface-0..3 mean something in both themes. */
|
|
238
|
-
--card:#
|
|
238
|
+
--card:#f2f2f2;
|
|
239
239
|
--card-foreground:#0a0a0a;
|
|
240
|
-
--popover:#
|
|
240
|
+
--popover:#fbfbfb;
|
|
241
241
|
--popover-foreground:#0a0a0a;
|
|
242
242
|
--primary:#0a0a0a;
|
|
243
243
|
--primary-hover:#262626;
|
|
244
244
|
--primary-foreground:#fafafa;
|
|
245
|
-
--secondary:#
|
|
245
|
+
--secondary:#e4e4e4;
|
|
246
246
|
--secondary-hover:#e0e0e0;
|
|
247
247
|
--secondary-foreground:#0a0a0a;
|
|
248
|
-
--muted:#
|
|
248
|
+
--muted:#ededed;
|
|
249
249
|
--muted-foreground:#525252;
|
|
250
|
-
--accent:#
|
|
250
|
+
--accent:#e4e4e4;
|
|
251
251
|
--accent-foreground:#0a0a0a;
|
|
252
252
|
--destructive:var(--state-error);
|
|
253
253
|
--destructive-hover:#dc2626;
|
|
@@ -272,9 +272,9 @@
|
|
|
272
272
|
--selection:rgb(0 0 0 / .16);
|
|
273
273
|
--glass:rgb(0 0 0 / .04);
|
|
274
274
|
--glass-strong:rgb(0 0 0 / .07);
|
|
275
|
-
--surface-card:#
|
|
276
|
-
--surface-card-emphasis:#
|
|
277
|
-
--surface-card-quiet:#
|
|
275
|
+
--surface-card:#f2f2f2;
|
|
276
|
+
--surface-card-emphasis:#fdfdfd;
|
|
277
|
+
--surface-card-quiet:#f5f5f5;
|
|
278
278
|
--surface-overlay:rgb(255 255 255 / .95);
|
|
279
279
|
--surface-header:rgb(255 255 255 / .8);
|
|
280
280
|
--surface-scrim:rgb(0 0 0 / .5);
|
|
@@ -2109,6 +2109,8 @@
|
|
|
2109
2109
|
:root ._bg-background{background-color:var(--background);}
|
|
2110
2110
|
:root ._bg-backgroundA94988999{background-color:var(--backgroundActive);}
|
|
2111
2111
|
:root ._bg-borderColor{background-color:var(--borderColor);}
|
|
2112
|
+
:root ._bg-color1{background-color:var(--color1);}
|
|
2113
|
+
:root ._bg-color10{background-color:var(--color10);}
|
|
2112
2114
|
:root ._bg-color12{background-color:var(--color12);}
|
|
2113
2115
|
:root ._bg-color2{background-color:var(--color2);}
|
|
2114
2116
|
:root ._bg-color3{background-color:var(--color3);}
|
package/dist/theme.css
CHANGED
|
@@ -229,23 +229,23 @@
|
|
|
229
229
|
silent (the border simply stops existing) and has shipped before. */
|
|
230
230
|
.light, :root.t_light, .t_light{
|
|
231
231
|
color-scheme:light;
|
|
232
|
-
--background:#
|
|
232
|
+
--background:#f7f7f7;
|
|
233
233
|
--foreground:#0a0a0a;
|
|
234
234
|
/* A ladder, not four names for #f5f5f5. Light lifts by the same tiny steps
|
|
235
235
|
dark does — ~2% per rung — so --surface-0..3 mean something in both themes. */
|
|
236
|
-
--card:#
|
|
236
|
+
--card:#f2f2f2;
|
|
237
237
|
--card-foreground:#0a0a0a;
|
|
238
|
-
--popover:#
|
|
238
|
+
--popover:#fbfbfb;
|
|
239
239
|
--popover-foreground:#0a0a0a;
|
|
240
240
|
--primary:#0a0a0a;
|
|
241
241
|
--primary-hover:#262626;
|
|
242
242
|
--primary-foreground:#fafafa;
|
|
243
|
-
--secondary:#
|
|
243
|
+
--secondary:#e4e4e4;
|
|
244
244
|
--secondary-hover:#e0e0e0;
|
|
245
245
|
--secondary-foreground:#0a0a0a;
|
|
246
|
-
--muted:#
|
|
246
|
+
--muted:#ededed;
|
|
247
247
|
--muted-foreground:#525252;
|
|
248
|
-
--accent:#
|
|
248
|
+
--accent:#e4e4e4;
|
|
249
249
|
--accent-foreground:#0a0a0a;
|
|
250
250
|
--destructive:var(--state-error);
|
|
251
251
|
--destructive-hover:#dc2626;
|
|
@@ -270,9 +270,9 @@
|
|
|
270
270
|
--selection:rgb(0 0 0 / .16);
|
|
271
271
|
--glass:rgb(0 0 0 / .04);
|
|
272
272
|
--glass-strong:rgb(0 0 0 / .07);
|
|
273
|
-
--surface-card:#
|
|
274
|
-
--surface-card-emphasis:#
|
|
275
|
-
--surface-card-quiet:#
|
|
273
|
+
--surface-card:#f2f2f2;
|
|
274
|
+
--surface-card-emphasis:#fdfdfd;
|
|
275
|
+
--surface-card-quiet:#f5f5f5;
|
|
276
276
|
--surface-overlay:rgb(255 255 255 / .95);
|
|
277
277
|
--surface-header:rgb(255 255 255 / .8);
|
|
278
278
|
--surface-scrim:rgb(0 0 0 / .5);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hanzo/ui",
|
|
3
|
-
"version": "8.0.
|
|
3
|
+
"version": "8.0.61",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Hanzo UI — the one canonical Hanzo component library, on @hanzo/gui + @hanzo/design. ONE substrate: every component renders through @hanzo/gui primitives, so the same import works on web, native (expo) and desktop (Tauri). Self-contained (theme.css), presentational, host-agnostic, clean-room.",
|
|
6
6
|
"exports": {
|
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"dist"
|
|
164
164
|
],
|
|
165
165
|
"dependencies": {
|
|
166
|
-
"@hanzo/design": "^0.4.
|
|
166
|
+
"@hanzo/design": "^0.4.7",
|
|
167
167
|
"@hanzo/logo": "^1.0.13",
|
|
168
168
|
"@hanzo/products": "^0.2.0",
|
|
169
169
|
"@hanzogui/lucide-icons-2": "^8.1.0",
|
|
@@ -176,10 +176,10 @@
|
|
|
176
176
|
"@hanzo/cd": ">=0.1.0",
|
|
177
177
|
"@hanzo/dashboard": ">=0.1.0",
|
|
178
178
|
"@hanzo/data": ">=1.2.0",
|
|
179
|
-
"@hanzo/gui": ">=8.
|
|
179
|
+
"@hanzo/gui": ">=8.1.0",
|
|
180
180
|
"@hanzo/usage": ">=0.1.0",
|
|
181
|
-
"@hanzogui/config": ">=8.
|
|
182
|
-
"@hanzogui/next-theme": ">=8.
|
|
181
|
+
"@hanzogui/config": ">=8.1.0",
|
|
182
|
+
"@hanzogui/next-theme": ">=8.1.0",
|
|
183
183
|
"next-themes": ">=0.2.1",
|
|
184
184
|
"react": ">=19",
|
|
185
185
|
"react-dom": ">=19",
|
package/dist/product/Palette.cjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
'use client';"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.Palette = Palette;
|
|
5
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
6
|
-
/**
|
|
7
|
-
* Palette — the ⌘K bar, once, for every Hanzo surface.
|
|
8
|
-
*
|
|
9
|
-
* hanzo.app, console and chat each grew their own: three lists of what can be
|
|
10
|
-
* run, all hand-written, already disagreeing with each other and with the API.
|
|
11
|
-
* This is the component half of ending that. The other half is `GET /v1/commands`,
|
|
12
|
-
* which projects every operation the cloud answers out of the one route table —
|
|
13
|
-
* so a surface passes that list in and stops maintaining one.
|
|
14
|
-
*
|
|
15
|
-
* It is composed from `CommandDialog`, not from a hand-rolled Dialog around a
|
|
16
|
-
* bare `Command`. That distinction is the whole history: the stock dialog used to
|
|
17
|
-
* render `<Command>` with none of the palette's props forwarded, so a host could
|
|
18
|
-
* not read the highlighted row and therefore could not draw a preview beside the
|
|
19
|
-
* list — and hanzo.app rebuilt the dialog by hand for exactly that reason. The
|
|
20
|
-
* forwarding landed upstream in this package and named collapsing the hand-rolled
|
|
21
|
-
* palettes as the follow-up. This is that follow-up, so the hand-rolled shape does
|
|
22
|
-
* not come back here under a new name.
|
|
23
|
-
*
|
|
24
|
-
* Props in, callbacks out, like everything else in this layer: no transport, no
|
|
25
|
-
* store, no routing. It does not fetch the commands, does not run them, and does
|
|
26
|
-
* not know what a project or an org is. `onRun` receives the Op and the surface
|
|
27
|
-
* decides whether that means an HTTP call or a function in the page — which is
|
|
28
|
-
* why a route command and a local command are one type (see `match.ts`).
|
|
29
|
-
*
|
|
30
|
-
* The right-hand slot is `children`, and it is why a shared bar costs no surface
|
|
31
|
-
* its personality: hanzo.app keeps its live project preview and console keeps its
|
|
32
|
-
* `>` AI mode by passing them, not by forking this.
|
|
33
|
-
*
|
|
34
|
-
* Filtering is `survivors`. The safe-methods-browse rule, the per-group cap and
|
|
35
|
-
* the empty-query behaviour all live in `match.ts` as pure functions, so
|
|
36
|
-
* `shouldFilter` is off and the Command primitive is left holding the cursor and
|
|
37
|
-
* the view — which is also what makes the rule testable without a DOM.
|
|
38
|
-
*/
|
|
39
|
-
const react_1 = require("react");
|
|
40
|
-
const gui_1 = require("@hanzo/gui");
|
|
41
|
-
const gui_2 = require("../backends/gui/index.cjs");
|
|
42
|
-
const match_1 = require("./match.cjs");
|
|
43
|
-
function Palette({ open, onOpenChange, ops, onRun, active, onActive, search: controlled, onSearch, placeholder = "Search commands…", empty = "No results found.", limit, children, footer, height = 320, title = "Search commands", }) {
|
|
44
|
-
const [own, setOwn] = (0, react_1.useState)("");
|
|
45
|
-
const search = controlled ?? own;
|
|
46
|
-
const setSearch = (s) => {
|
|
47
|
-
setOwn(s);
|
|
48
|
-
onSearch?.(s);
|
|
49
|
-
};
|
|
50
|
-
const groups = (0, react_1.useMemo)(() => (0, match_1.survivors)(ops, search, limit), [ops, search, limit]);
|
|
51
|
-
return ((0, jsx_runtime_1.jsxs)(gui_2.CommandDialog, { open: open, onOpenChange: onOpenChange, title: title, description: placeholder, value: active, onValueChange: onActive, shouldFilter: false, children: [(0, jsx_runtime_1.jsx)(gui_2.CommandInput, { value: search, onValueChange: setSearch, placeholder: placeholder, color: "$color", placeholderTextColor: "$color11" }), (0, jsx_runtime_1.jsxs)(gui_1.XStack, { minH: height, children: [(0, jsx_runtime_1.jsxs)(gui_2.CommandList, { maxH: height, width: children ? "50%" : "100%", borderRightWidth: children ? 1 : 0, borderColor: "$borderColor", py: "$1", children: [groups.length === 0 && ((0, jsx_runtime_1.jsx)(gui_2.CommandEmpty, { children: (0, jsx_runtime_1.jsx)(gui_1.SizableText, { color: "$color11", children: empty }) })), groups.map(([group, items]) => ((0, jsx_runtime_1.jsx)(gui_2.CommandGroup, { heading: group, children: items.map((op) => ((0, jsx_runtime_1.jsxs)(gui_2.CommandItem, { value: op.id, onSelect: () => onRun(op), gap: "$2", children: [op.icon, (0, jsx_runtime_1.jsxs)(gui_1.XStack, { flex: 1, items: "center", gap: "$2", overflow: "hidden", children: [(0, jsx_runtime_1.jsx)(gui_1.SizableText, { numberOfLines: 1, shrink: 0, children: op.label }), op.hint ? ((0, jsx_runtime_1.jsx)(gui_1.SizableText, { numberOfLines: 1, flex: 1, fontSize: "$1", color: "$color11", children: op.hint })) : null] }), (0, jsx_runtime_1.jsx)(Method, { of: op }), op.end] }, op.id))) }, group)))] }), children ? (0, jsx_runtime_1.jsx)(gui_1.YStack, { width: "50%", children: children }) : null] }), footer ? ((0, jsx_runtime_1.jsx)(gui_1.XStack, { items: "center", gap: "$4", borderTopWidth: 1, borderColor: "$borderColor", px: "$3", py: "$2", children: footer })) : null] }));
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* The method, at the end of the row, for route commands only.
|
|
55
|
-
*
|
|
56
|
-
* It is the rule made visible rather than decoration: GET is what you reached by
|
|
57
|
-
* browsing, anything else is what you reached by naming it exactly, and somebody
|
|
58
|
-
* about to press ↵ on `platform apps-rollback` should be able to see which
|
|
59
|
-
* without reading the docs. A local command has no method and gets no tag.
|
|
60
|
-
*/
|
|
61
|
-
function Method({ of }) {
|
|
62
|
-
if (of.method === undefined)
|
|
63
|
-
return null;
|
|
64
|
-
return ((0, jsx_runtime_1.jsx)(gui_1.SizableText, { shrink: 0, fontFamily: "$mono", fontSize: 10, letterSpacing: 0.4, color: of.method === match_1.SAFE ? "$color11" : "$color", children: of.method }));
|
|
65
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Palette — the ⌘K bar, once, for every Hanzo surface.
|
|
3
|
-
*
|
|
4
|
-
* hanzo.app, console and chat each grew their own: three lists of what can be
|
|
5
|
-
* run, all hand-written, already disagreeing with each other and with the API.
|
|
6
|
-
* This is the component half of ending that. The other half is `GET /v1/commands`,
|
|
7
|
-
* which projects every operation the cloud answers out of the one route table —
|
|
8
|
-
* so a surface passes that list in and stops maintaining one.
|
|
9
|
-
*
|
|
10
|
-
* It is composed from `CommandDialog`, not from a hand-rolled Dialog around a
|
|
11
|
-
* bare `Command`. That distinction is the whole history: the stock dialog used to
|
|
12
|
-
* render `<Command>` with none of the palette's props forwarded, so a host could
|
|
13
|
-
* not read the highlighted row and therefore could not draw a preview beside the
|
|
14
|
-
* list — and hanzo.app rebuilt the dialog by hand for exactly that reason. The
|
|
15
|
-
* forwarding landed upstream in this package and named collapsing the hand-rolled
|
|
16
|
-
* palettes as the follow-up. This is that follow-up, so the hand-rolled shape does
|
|
17
|
-
* not come back here under a new name.
|
|
18
|
-
*
|
|
19
|
-
* Props in, callbacks out, like everything else in this layer: no transport, no
|
|
20
|
-
* store, no routing. It does not fetch the commands, does not run them, and does
|
|
21
|
-
* not know what a project or an org is. `onRun` receives the Op and the surface
|
|
22
|
-
* decides whether that means an HTTP call or a function in the page — which is
|
|
23
|
-
* why a route command and a local command are one type (see `match.ts`).
|
|
24
|
-
*
|
|
25
|
-
* The right-hand slot is `children`, and it is why a shared bar costs no surface
|
|
26
|
-
* its personality: hanzo.app keeps its live project preview and console keeps its
|
|
27
|
-
* `>` AI mode by passing them, not by forking this.
|
|
28
|
-
*
|
|
29
|
-
* Filtering is `survivors`. The safe-methods-browse rule, the per-group cap and
|
|
30
|
-
* the empty-query behaviour all live in `match.ts` as pure functions, so
|
|
31
|
-
* `shouldFilter` is off and the Command primitive is left holding the cursor and
|
|
32
|
-
* the view — which is also what makes the rule testable without a DOM.
|
|
33
|
-
*/
|
|
34
|
-
import { type ReactNode } from "react";
|
|
35
|
-
import { type Op } from "./match.js";
|
|
36
|
-
export type PaletteProps = {
|
|
37
|
-
open: boolean;
|
|
38
|
-
onOpenChange: (open: boolean) => void;
|
|
39
|
-
/** Everything runnable, local commands and route commands alike. */
|
|
40
|
-
ops: Op[];
|
|
41
|
-
/** Run one. The surface decides what running it means. */
|
|
42
|
-
onRun: (op: Op) => void;
|
|
43
|
-
/**
|
|
44
|
-
* The highlighted row's id (controlled). A surface drawing a preview beside the
|
|
45
|
-
* list needs to know what is highlighted.
|
|
46
|
-
*/
|
|
47
|
-
active?: string;
|
|
48
|
-
onActive?: (id: string) => void;
|
|
49
|
-
/** The typed query. Uncontrolled unless a surface wants to read it. */
|
|
50
|
-
search?: string;
|
|
51
|
-
onSearch?: (search: string) => void;
|
|
52
|
-
placeholder?: string;
|
|
53
|
-
/** Shown when nothing survives the search. */
|
|
54
|
-
empty?: ReactNode;
|
|
55
|
-
/** Rows per group. See `survivors` — a render budget, not a preference. */
|
|
56
|
-
limit?: number;
|
|
57
|
-
/** The right-hand panel. Absent, the list takes the full width. */
|
|
58
|
-
children?: ReactNode;
|
|
59
|
-
/** The bar along the bottom — key hints, usually. */
|
|
60
|
-
footer?: ReactNode;
|
|
61
|
-
/** How tall the list is. It scrolls inside this. */
|
|
62
|
-
height?: number;
|
|
63
|
-
/** The dialog's accessible name. */
|
|
64
|
-
title?: string;
|
|
65
|
-
};
|
|
66
|
-
export declare function Palette({ open, onOpenChange, ops, onRun, active, onActive, search: controlled, onSearch, placeholder, empty, limit, children, footer, height, title, }: PaletteProps): import("react/jsx-runtime").JSX.Element;
|
|
67
|
-
//# sourceMappingURL=Palette.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Palette.d.ts","sourceRoot":"","sources":["../../src/product/Palette.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
/**
|
|
4
|
-
* Palette — the ⌘K bar, once, for every Hanzo surface.
|
|
5
|
-
*
|
|
6
|
-
* hanzo.app, console and chat each grew their own: three lists of what can be
|
|
7
|
-
* run, all hand-written, already disagreeing with each other and with the API.
|
|
8
|
-
* This is the component half of ending that. The other half is `GET /v1/commands`,
|
|
9
|
-
* which projects every operation the cloud answers out of the one route table —
|
|
10
|
-
* so a surface passes that list in and stops maintaining one.
|
|
11
|
-
*
|
|
12
|
-
* It is composed from `CommandDialog`, not from a hand-rolled Dialog around a
|
|
13
|
-
* bare `Command`. That distinction is the whole history: the stock dialog used to
|
|
14
|
-
* render `<Command>` with none of the palette's props forwarded, so a host could
|
|
15
|
-
* not read the highlighted row and therefore could not draw a preview beside the
|
|
16
|
-
* list — and hanzo.app rebuilt the dialog by hand for exactly that reason. The
|
|
17
|
-
* forwarding landed upstream in this package and named collapsing the hand-rolled
|
|
18
|
-
* palettes as the follow-up. This is that follow-up, so the hand-rolled shape does
|
|
19
|
-
* not come back here under a new name.
|
|
20
|
-
*
|
|
21
|
-
* Props in, callbacks out, like everything else in this layer: no transport, no
|
|
22
|
-
* store, no routing. It does not fetch the commands, does not run them, and does
|
|
23
|
-
* not know what a project or an org is. `onRun` receives the Op and the surface
|
|
24
|
-
* decides whether that means an HTTP call or a function in the page — which is
|
|
25
|
-
* why a route command and a local command are one type (see `match.ts`).
|
|
26
|
-
*
|
|
27
|
-
* The right-hand slot is `children`, and it is why a shared bar costs no surface
|
|
28
|
-
* its personality: hanzo.app keeps its live project preview and console keeps its
|
|
29
|
-
* `>` AI mode by passing them, not by forking this.
|
|
30
|
-
*
|
|
31
|
-
* Filtering is `survivors`. The safe-methods-browse rule, the per-group cap and
|
|
32
|
-
* the empty-query behaviour all live in `match.ts` as pure functions, so
|
|
33
|
-
* `shouldFilter` is off and the Command primitive is left holding the cursor and
|
|
34
|
-
* the view — which is also what makes the rule testable without a DOM.
|
|
35
|
-
*/
|
|
36
|
-
import { useMemo, useState } from "react";
|
|
37
|
-
import { SizableText, XStack, YStack } from "@hanzo/gui";
|
|
38
|
-
import { CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, } from "../backends/gui/index.js";
|
|
39
|
-
import { SAFE, survivors } from "./match.js";
|
|
40
|
-
export function Palette({ open, onOpenChange, ops, onRun, active, onActive, search: controlled, onSearch, placeholder = "Search commands…", empty = "No results found.", limit, children, footer, height = 320, title = "Search commands", }) {
|
|
41
|
-
const [own, setOwn] = useState("");
|
|
42
|
-
const search = controlled ?? own;
|
|
43
|
-
const setSearch = (s) => {
|
|
44
|
-
setOwn(s);
|
|
45
|
-
onSearch?.(s);
|
|
46
|
-
};
|
|
47
|
-
const groups = useMemo(() => survivors(ops, search, limit), [ops, search, limit]);
|
|
48
|
-
return (_jsxs(CommandDialog, { open: open, onOpenChange: onOpenChange, title: title, description: placeholder, value: active, onValueChange: onActive, shouldFilter: false, children: [_jsx(CommandInput, { value: search, onValueChange: setSearch, placeholder: placeholder, color: "$color", placeholderTextColor: "$color11" }), _jsxs(XStack, { minH: height, children: [_jsxs(CommandList, { maxH: height, width: children ? "50%" : "100%", borderRightWidth: children ? 1 : 0, borderColor: "$borderColor", py: "$1", children: [groups.length === 0 && (_jsx(CommandEmpty, { children: _jsx(SizableText, { color: "$color11", children: empty }) })), groups.map(([group, items]) => (_jsx(CommandGroup, { heading: group, children: items.map((op) => (_jsxs(CommandItem, { value: op.id, onSelect: () => onRun(op), gap: "$2", children: [op.icon, _jsxs(XStack, { flex: 1, items: "center", gap: "$2", overflow: "hidden", children: [_jsx(SizableText, { numberOfLines: 1, shrink: 0, children: op.label }), op.hint ? (_jsx(SizableText, { numberOfLines: 1, flex: 1, fontSize: "$1", color: "$color11", children: op.hint })) : null] }), _jsx(Method, { of: op }), op.end] }, op.id))) }, group)))] }), children ? _jsx(YStack, { width: "50%", children: children }) : null] }), footer ? (_jsx(XStack, { items: "center", gap: "$4", borderTopWidth: 1, borderColor: "$borderColor", px: "$3", py: "$2", children: footer })) : null] }));
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* The method, at the end of the row, for route commands only.
|
|
52
|
-
*
|
|
53
|
-
* It is the rule made visible rather than decoration: GET is what you reached by
|
|
54
|
-
* browsing, anything else is what you reached by naming it exactly, and somebody
|
|
55
|
-
* about to press ↵ on `platform apps-rollback` should be able to see which
|
|
56
|
-
* without reading the docs. A local command has no method and gets no tag.
|
|
57
|
-
*/
|
|
58
|
-
function Method({ of }) {
|
|
59
|
-
if (of.method === undefined)
|
|
60
|
-
return null;
|
|
61
|
-
return (_jsx(SizableText, { shrink: 0, fontFamily: "$mono", fontSize: 10, letterSpacing: 0.4, color: of.method === SAFE ? "$color11" : "$color", children: of.method }));
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=Palette.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Palette.js","sourceRoot":"","sources":["../../src/product/Palette.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,OAAO,EAAkB,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExD,OAAO,EACL,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,GACZ,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,IAAI,EAAE,SAAS,EAAW,MAAM,SAAS,CAAA;AAiClD,MAAM,UAAU,OAAO,CAAC,EACtB,IAAI,EACJ,YAAY,EACZ,GAAG,EACH,KAAK,EACL,MAAM,EACN,QAAQ,EACR,MAAM,EAAE,UAAU,EAClB,QAAQ,EACR,WAAW,GAAG,kBAAkB,EAChC,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ACjB,WAAW,EAAC,cAAc,EAC1B,EAAE,EAAC,IAAI,EACP,EAAE,EAAC,IAAI,YAEN,MAAM,GACA,CACV,CAAC,CAAC,CAAC,IAAI,IACM,CACjB,CAAA;AACH,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,MAAM,CAAC,EAAE,EAAE,EAAc;IAChC,IAAI,EAAE,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,IAAI,CAAA;IACxC,OAAO,CACL,KAAC,WAAW,IACV,MAAM,EAAE,CAAC,EACT,UAAU,EAAC,OAAO,EAClB,QAAQ,EAAE,EAAE,EACZ,aAAa,EAAE,GAAG,EAClB,KAAK,EAAE,EAAE,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,YAEhD,EAAE,CAAC,MAAM,GACE,CACf,CAAA;AACH,CAAC"}
|
package/dist/product/match.cjs
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
'use client';"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.survivors = exports.match = exports.SAFE = void 0;
|
|
4
|
-
const command_logic_1 = require("../backends/gui/command.logic.cjs");
|
|
5
|
-
/** The one method that is safe to stumble onto: no side effect, idempotent. */
|
|
6
|
-
exports.SAFE = 'GET';
|
|
7
|
-
/**
|
|
8
|
-
* Whether `op` survives `search`, and how well. `0` hides it.
|
|
9
|
-
*
|
|
10
|
-
* # Safe methods browse; unsafe methods must be named
|
|
11
|
-
*
|
|
12
|
-
* Typing "delete" into a bar holding 2,323 operations offers four dozen
|
|
13
|
-
* destructive fleet operations to somebody who wanted to delete a project. The
|
|
14
|
-
* rule that fixes it needs no second list and no curation, because the method is
|
|
15
|
-
* already in the registry and already means exactly this:
|
|
16
|
-
*
|
|
17
|
-
* - GET matches fuzzily. It is safe and idempotent; browsing costs nothing.
|
|
18
|
-
* - every other method needs an exact PREFIX of `group label` — the same
|
|
19
|
-
* "service operation" a CLI would type. You cannot stumble onto
|
|
20
|
-
* `platform apps-rollback`; you have to name it.
|
|
21
|
-
*
|
|
22
|
-
* One rule, over data already present, mapping onto the semantics the methods
|
|
23
|
-
* already carry.
|
|
24
|
-
*
|
|
25
|
-
* # An empty search hides every route, and that is not a shortcut
|
|
26
|
-
*
|
|
27
|
-
* With no query a fuzzy matcher matches everything, and everything is 2,323 rows
|
|
28
|
-
* the moment the dialog opens — which is not a list, it is a stalled browser and
|
|
29
|
-
* a scroll bar nobody can use. So the Run group is a SEARCH, not a browse: it is
|
|
30
|
-
* empty until you type, and what remains on open is the surface's own handful of
|
|
31
|
-
* local commands, which is what a person opening ⌘K with no query wants anyway.
|
|
32
|
-
*
|
|
33
|
-
* A local command has no method and is therefore always reachable — it is one of
|
|
34
|
-
* a few, declared by the surface, and there is nothing to protect anyone from.
|
|
35
|
-
*/
|
|
36
|
-
const match = (op, search) => {
|
|
37
|
-
const q = search.trim().toLowerCase();
|
|
38
|
-
const route = op.method !== undefined;
|
|
39
|
-
if (!q)
|
|
40
|
-
return route ? 0 : 1;
|
|
41
|
-
const named = `${op.group} ${op.label}`.toLowerCase();
|
|
42
|
-
if (route && op.method !== exports.SAFE)
|
|
43
|
-
return named.startsWith(q) ? 1 : 0;
|
|
44
|
-
return (0, command_logic_1.score)(named, q, op.hint ? [op.hint] : undefined);
|
|
45
|
-
};
|
|
46
|
-
exports.match = match;
|
|
47
|
-
/**
|
|
48
|
-
* The ops that survive `search`, grouped for rendering: headings in the order the
|
|
49
|
-
* caller listed them, rows ranked within each, empty groups dropped.
|
|
50
|
-
*
|
|
51
|
-
* `limit` caps each group. A GET search for "list" still matches hundreds, and a
|
|
52
|
-
* palette that renders hundreds is the same stalled browser the empty query would
|
|
53
|
-
* be — the cap is what keeps one keystroke's cost bounded whatever was typed.
|
|
54
|
-
*/
|
|
55
|
-
const survivors = (ops, search, limit = 50) => {
|
|
56
|
-
const groups = new Map();
|
|
57
|
-
for (const op of ops) {
|
|
58
|
-
const rank = (0, exports.match)(op, search);
|
|
59
|
-
if (rank <= 0)
|
|
60
|
-
continue;
|
|
61
|
-
const got = groups.get(op.group);
|
|
62
|
-
if (got)
|
|
63
|
-
got.push([op, rank]);
|
|
64
|
-
else
|
|
65
|
-
groups.set(op.group, [[op, rank]]);
|
|
66
|
-
}
|
|
67
|
-
const out = [];
|
|
68
|
-
for (const [group, ranked] of groups) {
|
|
69
|
-
// Sort by rank, ties keeping the caller's order — a surface that ordered its
|
|
70
|
-
// projects by recency must not have that undone by a scoring tie.
|
|
71
|
-
ranked.sort((a, b) => b[1] - a[1]);
|
|
72
|
-
out.push([group, ranked.slice(0, limit).map(([op]) => op)]);
|
|
73
|
-
}
|
|
74
|
-
return out;
|
|
75
|
-
};
|
|
76
|
-
exports.survivors = survivors;
|
package/dist/product/match.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* What the ⌘K bar shows for what you typed, as one pure function.
|
|
3
|
-
*
|
|
4
|
-
* The bar's list is not hand-written any more. hanzo.app's cloud publishes
|
|
5
|
-
* `GET /v1/commands` — every operation the API answers, projected from the same
|
|
6
|
-
* route table the OpenAPI document, the MCP tools and the `hanzo` CLI come from —
|
|
7
|
-
* so a surface hands the whole list in and this decides what survives a search.
|
|
8
|
-
*
|
|
9
|
-
* That list is 2,323 operations, and that number is what makes the rule below
|
|
10
|
-
* more than a preference.
|
|
11
|
-
*/
|
|
12
|
-
import type { ReactNode } from 'react';
|
|
13
|
-
/**
|
|
14
|
-
* One runnable thing in the bar.
|
|
15
|
-
*
|
|
16
|
-
* A command that names a route and a command that runs in the page are the SAME
|
|
17
|
-
* type here; only the surface's `onRun` tells them apart. `method` is what says
|
|
18
|
-
* which — it is present exactly when the command is an HTTP operation, and it is
|
|
19
|
-
* the only field the matching rule reads.
|
|
20
|
-
*/
|
|
21
|
-
export interface Op {
|
|
22
|
-
/** Stable identity. The registry's operationId, or a surface-local name. */
|
|
23
|
-
id: string;
|
|
24
|
-
/** The heading it files under — a service ("projects"), or a surface's own. */
|
|
25
|
-
group: string;
|
|
26
|
-
/** What it is called: the operation token ("deployments-list"), or a phrase. */
|
|
27
|
-
label: string;
|
|
28
|
-
/** One line of help. The operation's summary, when it has one. */
|
|
29
|
-
hint?: string;
|
|
30
|
-
/** The HTTP method, when this names a route. Absent means it runs in the page. */
|
|
31
|
-
method?: string;
|
|
32
|
-
/** Drawn at the start of the row. */
|
|
33
|
-
icon?: ReactNode;
|
|
34
|
-
/** Drawn at the end of the row — a status dot, a shortcut. */
|
|
35
|
-
end?: ReactNode;
|
|
36
|
-
}
|
|
37
|
-
/** The one method that is safe to stumble onto: no side effect, idempotent. */
|
|
38
|
-
export declare const SAFE = "GET";
|
|
39
|
-
/**
|
|
40
|
-
* Whether `op` survives `search`, and how well. `0` hides it.
|
|
41
|
-
*
|
|
42
|
-
* # Safe methods browse; unsafe methods must be named
|
|
43
|
-
*
|
|
44
|
-
* Typing "delete" into a bar holding 2,323 operations offers four dozen
|
|
45
|
-
* destructive fleet operations to somebody who wanted to delete a project. The
|
|
46
|
-
* rule that fixes it needs no second list and no curation, because the method is
|
|
47
|
-
* already in the registry and already means exactly this:
|
|
48
|
-
*
|
|
49
|
-
* - GET matches fuzzily. It is safe and idempotent; browsing costs nothing.
|
|
50
|
-
* - every other method needs an exact PREFIX of `group label` — the same
|
|
51
|
-
* "service operation" a CLI would type. You cannot stumble onto
|
|
52
|
-
* `platform apps-rollback`; you have to name it.
|
|
53
|
-
*
|
|
54
|
-
* One rule, over data already present, mapping onto the semantics the methods
|
|
55
|
-
* already carry.
|
|
56
|
-
*
|
|
57
|
-
* # An empty search hides every route, and that is not a shortcut
|
|
58
|
-
*
|
|
59
|
-
* With no query a fuzzy matcher matches everything, and everything is 2,323 rows
|
|
60
|
-
* the moment the dialog opens — which is not a list, it is a stalled browser and
|
|
61
|
-
* a scroll bar nobody can use. So the Run group is a SEARCH, not a browse: it is
|
|
62
|
-
* empty until you type, and what remains on open is the surface's own handful of
|
|
63
|
-
* local commands, which is what a person opening ⌘K with no query wants anyway.
|
|
64
|
-
*
|
|
65
|
-
* A local command has no method and is therefore always reachable — it is one of
|
|
66
|
-
* a few, declared by the surface, and there is nothing to protect anyone from.
|
|
67
|
-
*/
|
|
68
|
-
export declare const match: (op: Op, search: string) => number;
|
|
69
|
-
/**
|
|
70
|
-
* The ops that survive `search`, grouped for rendering: headings in the order the
|
|
71
|
-
* caller listed them, rows ranked within each, empty groups dropped.
|
|
72
|
-
*
|
|
73
|
-
* `limit` caps each group. A GET search for "list" still matches hundreds, and a
|
|
74
|
-
* palette that renders hundreds is the same stalled browser the empty query would
|
|
75
|
-
* be — the cap is what keeps one keystroke's cost bounded whatever was typed.
|
|
76
|
-
*/
|
|
77
|
-
export declare const survivors: (ops: Op[], search: string, limit?: number) => Array<[string, Op[]]>;
|
|
78
|
-
//# sourceMappingURL=match.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../src/product/match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAItC;;;;;;;GAOG;AACH,MAAM,WAAW,EAAE;IACjB,4EAA4E;IAC5E,EAAE,EAAE,MAAM,CAAA;IACV,+EAA+E;IAC/E,KAAK,EAAE,MAAM,CAAA;IACb,gFAAgF;IAChF,KAAK,EAAE,MAAM,CAAA;IACb,kEAAkE;IAClE,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,qCAAqC;IACrC,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,8DAA8D;IAC9D,GAAG,CAAC,EAAE,SAAS,CAAA;CAChB;AAED,+EAA+E;AAC/E,eAAO,MAAM,IAAI,QAAQ,CAAA;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,eAAO,MAAM,KAAK,GAAI,IAAI,EAAE,EAAE,QAAQ,MAAM,KAAG,MAQ9C,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,KAAK,EAAE,EAAE,EAAE,QAAQ,MAAM,EAAE,cAAU,KAAG,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,EAAE,CAAC,CAiBrF,CAAA"}
|
package/dist/product/match.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
'use client';import { score } from '../backends/gui/command.logic.js';
|
|
2
|
-
/** The one method that is safe to stumble onto: no side effect, idempotent. */
|
|
3
|
-
export const SAFE = 'GET';
|
|
4
|
-
/**
|
|
5
|
-
* Whether `op` survives `search`, and how well. `0` hides it.
|
|
6
|
-
*
|
|
7
|
-
* # Safe methods browse; unsafe methods must be named
|
|
8
|
-
*
|
|
9
|
-
* Typing "delete" into a bar holding 2,323 operations offers four dozen
|
|
10
|
-
* destructive fleet operations to somebody who wanted to delete a project. The
|
|
11
|
-
* rule that fixes it needs no second list and no curation, because the method is
|
|
12
|
-
* already in the registry and already means exactly this:
|
|
13
|
-
*
|
|
14
|
-
* - GET matches fuzzily. It is safe and idempotent; browsing costs nothing.
|
|
15
|
-
* - every other method needs an exact PREFIX of `group label` — the same
|
|
16
|
-
* "service operation" a CLI would type. You cannot stumble onto
|
|
17
|
-
* `platform apps-rollback`; you have to name it.
|
|
18
|
-
*
|
|
19
|
-
* One rule, over data already present, mapping onto the semantics the methods
|
|
20
|
-
* already carry.
|
|
21
|
-
*
|
|
22
|
-
* # An empty search hides every route, and that is not a shortcut
|
|
23
|
-
*
|
|
24
|
-
* With no query a fuzzy matcher matches everything, and everything is 2,323 rows
|
|
25
|
-
* the moment the dialog opens — which is not a list, it is a stalled browser and
|
|
26
|
-
* a scroll bar nobody can use. So the Run group is a SEARCH, not a browse: it is
|
|
27
|
-
* empty until you type, and what remains on open is the surface's own handful of
|
|
28
|
-
* local commands, which is what a person opening ⌘K with no query wants anyway.
|
|
29
|
-
*
|
|
30
|
-
* A local command has no method and is therefore always reachable — it is one of
|
|
31
|
-
* a few, declared by the surface, and there is nothing to protect anyone from.
|
|
32
|
-
*/
|
|
33
|
-
export const match = (op, search) => {
|
|
34
|
-
const q = search.trim().toLowerCase();
|
|
35
|
-
const route = op.method !== undefined;
|
|
36
|
-
if (!q)
|
|
37
|
-
return route ? 0 : 1;
|
|
38
|
-
const named = `${op.group} ${op.label}`.toLowerCase();
|
|
39
|
-
if (route && op.method !== SAFE)
|
|
40
|
-
return named.startsWith(q) ? 1 : 0;
|
|
41
|
-
return score(named, q, op.hint ? [op.hint] : undefined);
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* The ops that survive `search`, grouped for rendering: headings in the order the
|
|
45
|
-
* caller listed them, rows ranked within each, empty groups dropped.
|
|
46
|
-
*
|
|
47
|
-
* `limit` caps each group. A GET search for "list" still matches hundreds, and a
|
|
48
|
-
* palette that renders hundreds is the same stalled browser the empty query would
|
|
49
|
-
* be — the cap is what keeps one keystroke's cost bounded whatever was typed.
|
|
50
|
-
*/
|
|
51
|
-
export const survivors = (ops, search, limit = 50) => {
|
|
52
|
-
const groups = new Map();
|
|
53
|
-
for (const op of ops) {
|
|
54
|
-
const rank = match(op, search);
|
|
55
|
-
if (rank <= 0)
|
|
56
|
-
continue;
|
|
57
|
-
const got = groups.get(op.group);
|
|
58
|
-
if (got)
|
|
59
|
-
got.push([op, rank]);
|
|
60
|
-
else
|
|
61
|
-
groups.set(op.group, [[op, rank]]);
|
|
62
|
-
}
|
|
63
|
-
const out = [];
|
|
64
|
-
for (const [group, ranked] of groups) {
|
|
65
|
-
// Sort by rank, ties keeping the caller's order — a surface that ordered its
|
|
66
|
-
// projects by recency must not have that undone by a scoring tie.
|
|
67
|
-
ranked.sort((a, b) => b[1] - a[1]);
|
|
68
|
-
out.push([group, ranked.slice(0, limit).map(([op]) => op)]);
|
|
69
|
-
}
|
|
70
|
-
return out;
|
|
71
|
-
};
|
|
72
|
-
//# sourceMapp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AG,KAAK,CAAC,EAAE,EAAE,MAAM,CAAC,CAAA;QAC9B,IAAI,IAAI,IAAI,CAAC;YAAE,SAAQ;QACvB,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,CAAA;QAChC,IAAI,GAAG;YAAE,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAA;;YACxB,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;IACzC,CAAC;IACD,MAAM,GAAG,GAA0B,EAAE,CAAA;IACrC,KAAK,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACrC,6EAA6E;QAC7E,kEAAkE;QAClE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAClC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAC7D,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
'use client';"use strict";
|
|
2
|
-
'use client';
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.useCommandK = useCommandK;
|
|
5
|
-
/**
|
|
6
|
-
* useCommandK — the ONE keybinding for the command palette.
|
|
7
|
-
*
|
|
8
|
-
* ⌘K / Ctrl-K always toggles (even from a text field — it is the universal
|
|
9
|
-
* palette shortcut and nothing else may claim it). `/` also opens it, but ONLY
|
|
10
|
-
* when the user is NOT typing in a field, so a slash inside an input, a textarea
|
|
11
|
-
* or a contenteditable types a slash. Pass `slash: false` to bind ⌘K alone.
|
|
12
|
-
*
|
|
13
|
-
* That second rule is why chat needs no exception written for it. Its composer is
|
|
14
|
-
* a TEXTAREA, so the global `/` never fires there and the composer's own prompts
|
|
15
|
-
* popover keeps the key it has. The same rule makes a `/` typed into the palette's
|
|
16
|
-
* own input a literal slash. There is no precedence to encode — the one condition
|
|
17
|
-
* already answers all three, and the instinct to add an exception would be adding
|
|
18
|
-
* dead code.
|
|
19
|
-
*
|
|
20
|
-
* One hook, so every surface that hosts the palette shares identical behaviour
|
|
21
|
-
* instead of a divergent inline listener each. It moved here from hanzo.app,
|
|
22
|
-
* which is where it was already correct.
|
|
23
|
-
*/
|
|
24
|
-
const react_1 = require("react");
|
|
25
|
-
function isEditable(target) {
|
|
26
|
-
const el = target;
|
|
27
|
-
if (!el || typeof HTMLElement === "undefined" || !(el instanceof HTMLElement))
|
|
28
|
-
return false;
|
|
29
|
-
const tag = el.tagName;
|
|
30
|
-
return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || el.isContentEditable;
|
|
31
|
-
}
|
|
32
|
-
function useCommandK(onTrigger, opts) {
|
|
33
|
-
const slash = opts?.slash !== false;
|
|
34
|
-
(0, react_1.useEffect)(() => {
|
|
35
|
-
const onKey = (e) => {
|
|
36
|
-
const cmdK = (e.metaKey || e.ctrlKey) && !e.altKey && e.key.toLowerCase() === "k";
|
|
37
|
-
const slashKey = slash && e.key === "/" && !e.metaKey && !e.ctrlKey && !e.altKey && !isEditable(e.target);
|
|
38
|
-
if (cmdK || slashKey) {
|
|
39
|
-
e.preventDefault();
|
|
40
|
-
onTrigger();
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
window.addEventListener("keydown", onKey);
|
|
44
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
45
|
-
}, [onTrigger, slash]);
|
|
46
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCommandK.d.ts","sourceRoot":"","sources":["../../src/product/useCommandK.ts"],"names":[],"mappings":"AA8BA,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,IAAI,EAAE,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,IAAI,CAenF"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
/**
|
|
3
|
-
* useCommandK — the ONE keybinding for the command palette.
|
|
4
|
-
*
|
|
5
|
-
* ⌘K / Ctrl-K always toggles (even from a text field — it is the universal
|
|
6
|
-
* palette shortcut and nothing else may claim it). `/` also opens it, but ONLY
|
|
7
|
-
* when the user is NOT typing in a field, so a slash inside an input, a textarea
|
|
8
|
-
* or a contenteditable types a slash. Pass `slash: false` to bind ⌘K alone.
|
|
9
|
-
*
|
|
10
|
-
* That second rule is why chat needs no exception written for it. Its composer is
|
|
11
|
-
* a TEXTAREA, so the global `/` never fires there and the composer's own prompts
|
|
12
|
-
* popover keeps the key it has. The same rule makes a `/` typed into the palette's
|
|
13
|
-
* own input a literal slash. There is no precedence to encode — the one condition
|
|
14
|
-
* already answers all three, and the instinct to add an exception would be adding
|
|
15
|
-
* dead code.
|
|
16
|
-
*
|
|
17
|
-
* One hook, so every surface that hosts the palette shares identical behaviour
|
|
18
|
-
* instead of a divergent inline listener each. It moved here from hanzo.app,
|
|
19
|
-
* which is where it was already correct.
|
|
20
|
-
*/
|
|
21
|
-
import { useEffect } from "react";
|
|
22
|
-
function isEditable(target) {
|
|
23
|
-
const el = target;
|
|
24
|
-
if (!el || typeof HTMLElement === "undefined" || !(el instanceof HTMLElement))
|
|
25
|
-
return false;
|
|
26
|
-
const tag = el.tagName;
|
|
27
|
-
return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || el.isContentEditable;
|
|
28
|
-
}
|
|
29
|
-
export function useCommandK(onTrigger, opts) {
|
|
30
|
-
const slash = opts?.slash !== false;
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
const onKey = (e) => {
|
|
33
|
-
const cmdK = (e.metaKey || e.ctrlKey) && !e.altKey && e.key.toLowerCase() === "k";
|
|
34
|
-
const slashKey = slash && e.key === "/" && !e.metaKey && !e.ctrlKey && !e.altKey && !isEditable(e.target);
|
|
35
|
-
if (cmdK || slashKey) {
|
|
36
|
-
e.preventDefault();
|
|
37
|
-
onTrigger();
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
window.addEventListener("keydown", onKey);
|
|
41
|
-
return () => window.removeEventListener("keydown", onKey);
|
|
42
|
-
}, [onTrigger, slash]);
|
|
43
|
-
}
|
|
44
|
-
//# sourceMappingURL=useCommandK.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCommandK.js","sourceRoot":"","sources":["../../src/product/useCommandK.ts"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEjC,SAAS,UAAU,CAAC,MAA0B;IAC5C,MAAM,EAAE,GAAG,MAA4B,CAAA;IACvC,IAAI,CAAC,EAAE,IAAI,OAAO,WAAW,KAAK,WAAW,IAAI,CAAC,CAAC,EAAE,YAAY,WAAW,CAAC;QAAE,OAAO,KAAK,CAAA;IAC3F,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAA;IACtB,OAAO,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,UAAU,IAAI,GAAG,KAAK,QAAQ,IAAI,EAAE,CAAC,iBAAiB,CAAA;AAC1F,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,SAAqB,EAAE,IAA0B;IAC3E,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK,KAAK,KAAK,CAAA;IACnC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,KAAK,GAAG,CAAC,CAAgB,EAAE,EAAE;YACjC,MAAM,IAAI,GAAG,CAAC,CAAC,CAA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