overmux 0.0.1
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/bin.js +8136 -0
- package/dist/public/core.ts +119 -0
- package/dist/public/protocol.ts +51 -0
- package/dist/public/terminal.ts +23 -0
- package/dist/web/assets/index-DC___IUw.css +2 -0
- package/dist/web/assets/index-DF9Cptse.js +74 -0
- package/dist/web/assets/terminal-component-BrP-ENHg.css +1 -0
- package/dist/web/assets/terminal-component-DyLEbMrx.js +36 -0
- package/dist/web/index.html +14 -0
- package/package.json +48 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const paneRefSchema = z.object({
|
|
4
|
+
muxId: z.string().min(1),
|
|
5
|
+
target: z.string().min(1),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
export type PaneRef = z.infer<typeof paneRefSchema>;
|
|
9
|
+
|
|
10
|
+
export const clientComponentRefSchema = z.object({
|
|
11
|
+
kind: z.literal("client-component"),
|
|
12
|
+
moduleId: z.string().min(1),
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export type ClientComponentRef = z.infer<typeof clientComponentRefSchema>;
|
|
16
|
+
|
|
17
|
+
export const clientComponent = (moduleId: string): ClientComponentRef =>
|
|
18
|
+
clientComponentRefSchema.parse({ kind: "client-component", moduleId });
|
|
19
|
+
|
|
20
|
+
export type TabTypeDefinition<
|
|
21
|
+
TType extends string = string,
|
|
22
|
+
TSchema extends z.ZodType = z.ZodType,
|
|
23
|
+
> = {
|
|
24
|
+
component: ClientComponentRef;
|
|
25
|
+
data: TSchema;
|
|
26
|
+
type: TType;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const defineTabType = <
|
|
30
|
+
const TType extends string,
|
|
31
|
+
TSchema extends z.ZodType,
|
|
32
|
+
>(
|
|
33
|
+
definition: TabTypeDefinition<TType, TSchema>,
|
|
34
|
+
) => definition;
|
|
35
|
+
|
|
36
|
+
type ConfiguredTab<TTabTypes extends readonly TabTypeDefinition[]> = {
|
|
37
|
+
[TIndex in keyof TTabTypes]: TTabTypes[TIndex] extends TabTypeDefinition<
|
|
38
|
+
infer TType,
|
|
39
|
+
infer TSchema
|
|
40
|
+
>
|
|
41
|
+
? {
|
|
42
|
+
data: z.input<TSchema>;
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
type: TType;
|
|
46
|
+
}
|
|
47
|
+
: never;
|
|
48
|
+
}[number];
|
|
49
|
+
|
|
50
|
+
export type SidebarEntry<
|
|
51
|
+
TTabTypes extends readonly TabTypeDefinition[] = readonly TabTypeDefinition[],
|
|
52
|
+
> = {
|
|
53
|
+
id: string;
|
|
54
|
+
status?: string;
|
|
55
|
+
subtitle?: string;
|
|
56
|
+
tabs: Array<ConfiguredTab<TTabTypes>>;
|
|
57
|
+
title: string;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type SidebarContext = {
|
|
61
|
+
invalidate: () => void;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type ConfigDefinition<
|
|
65
|
+
TTabTypes extends readonly TabTypeDefinition[] = readonly TabTypeDefinition[],
|
|
66
|
+
> = {
|
|
67
|
+
muxes?: Record<string, unknown>;
|
|
68
|
+
sidebar: (
|
|
69
|
+
context: SidebarContext,
|
|
70
|
+
) => Promise<Array<SidebarEntry<TTabTypes>>> | Array<SidebarEntry<TTabTypes>>;
|
|
71
|
+
tabTypes: TTabTypes;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const defineConfig = <
|
|
75
|
+
const TTabTypes extends readonly TabTypeDefinition[],
|
|
76
|
+
>(
|
|
77
|
+
definition: ConfigDefinition<TTabTypes>,
|
|
78
|
+
) => definition;
|
|
79
|
+
|
|
80
|
+
const isZodSchema = (value: unknown): value is z.ZodType =>
|
|
81
|
+
typeof value === "object" &&
|
|
82
|
+
value !== null &&
|
|
83
|
+
"safeParse" in value &&
|
|
84
|
+
typeof value.safeParse === "function";
|
|
85
|
+
|
|
86
|
+
const sidebarFunctionSchema = z.custom<ConfigDefinition["sidebar"]>(
|
|
87
|
+
(value) => typeof value === "function",
|
|
88
|
+
"Expected a sidebar function",
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
export const tabTypeDefinitionRuntimeSchema = z.object({
|
|
92
|
+
component: clientComponentRefSchema,
|
|
93
|
+
data: z.custom<z.ZodType>(isZodSchema, "Expected a Zod schema"),
|
|
94
|
+
type: z.string().min(1),
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export const configDefinitionRuntimeSchema = z
|
|
98
|
+
.object({
|
|
99
|
+
muxes: z.record(z.string(), z.unknown()).optional(),
|
|
100
|
+
sidebar: sidebarFunctionSchema,
|
|
101
|
+
tabTypes: z.array(tabTypeDefinitionRuntimeSchema),
|
|
102
|
+
})
|
|
103
|
+
.superRefine(({ tabTypes }, context) => {
|
|
104
|
+
const seen = new Set<string>();
|
|
105
|
+
tabTypes.forEach(({ type }, index) => {
|
|
106
|
+
if (seen.has(type)) {
|
|
107
|
+
context.addIssue({
|
|
108
|
+
code: "custom",
|
|
109
|
+
message: `Duplicate tab type: ${type}`,
|
|
110
|
+
path: ["tabTypes", index, "type"],
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
seen.add(type);
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
export type RuntimeConfigDefinition = z.infer<
|
|
118
|
+
typeof configDefinitionRuntimeSchema
|
|
119
|
+
>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const protocolVersion = 1 as const;
|
|
4
|
+
|
|
5
|
+
export const clientComponentManifestEntrySchema = z.object({
|
|
6
|
+
id: z.string().min(1),
|
|
7
|
+
type: z.string().min(1),
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export const sidebarTabSnapshotSchema = z.object({
|
|
11
|
+
data: z.unknown(),
|
|
12
|
+
id: z.string().min(1),
|
|
13
|
+
title: z.string().min(1),
|
|
14
|
+
type: z.string().min(1),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export const sidebarEntrySnapshotSchema = z.object({
|
|
18
|
+
id: z.string().min(1),
|
|
19
|
+
status: z.string().optional(),
|
|
20
|
+
subtitle: z.string().optional(),
|
|
21
|
+
tabs: z.array(sidebarTabSnapshotSchema),
|
|
22
|
+
title: z.string().min(1),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const bootstrapResponseSchema = z.object({
|
|
26
|
+
generation: z.number().int().positive(),
|
|
27
|
+
protocolVersion: z.literal(protocolVersion),
|
|
28
|
+
sidebar: z.array(sidebarEntrySnapshotSchema),
|
|
29
|
+
tabTypes: z.array(clientComponentManifestEntrySchema),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const runtimePublishedEventSchema = z.object({
|
|
33
|
+
generation: z.number().int().positive(),
|
|
34
|
+
type: z.literal("runtime-published"),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export const runtimeErrorEventSchema = z.object({
|
|
38
|
+
generation: z.number().int().nonnegative(),
|
|
39
|
+
message: z.string(),
|
|
40
|
+
type: z.literal("runtime-error"),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const runtimeEventSchema = z.discriminatedUnion("type", [
|
|
44
|
+
runtimePublishedEventSchema,
|
|
45
|
+
runtimeErrorEventSchema,
|
|
46
|
+
]);
|
|
47
|
+
|
|
48
|
+
export type BootstrapResponse = z.infer<typeof bootstrapResponseSchema>;
|
|
49
|
+
export type RuntimeEvent = z.infer<typeof runtimeEventSchema>;
|
|
50
|
+
export type SidebarEntrySnapshot = z.infer<typeof sidebarEntrySnapshotSchema>;
|
|
51
|
+
export type SidebarTabSnapshot = z.infer<typeof sidebarTabSnapshotSchema>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { clientComponent, defineTabType, paneRefSchema } from "./core.ts";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export const terminalTabDataSchema = z.object({
|
|
5
|
+
pane: paneRefSchema,
|
|
6
|
+
readOnly: z.boolean().default(true),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type TerminalTabData = z.infer<typeof terminalTabDataSchema>;
|
|
10
|
+
|
|
11
|
+
export const terminalTabType = defineTabType({
|
|
12
|
+
component: clientComponent("overmux/tabs/terminal-component"),
|
|
13
|
+
data: terminalTabDataSchema,
|
|
14
|
+
type: "terminal",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export type TerminalRenderer = {
|
|
18
|
+
dispose: () => void;
|
|
19
|
+
mount: (element: HTMLElement) => void;
|
|
20
|
+
onInput: (handler: (bytes: Uint8Array) => void) => () => void;
|
|
21
|
+
resize: (size: { cols: number; rows: number }) => void;
|
|
22
|
+
write: (bytes: Uint8Array) => void;
|
|
23
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! tailwindcss v4.1.10 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-space-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial}}}@layer theme{:root,:host{--font-sans:"DM Sans",system-ui,sans-serif;--font-mono:"JetBrains Mono",monospace;--color-red-300:oklch(80.8% .114 19.571);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-500:oklch(69.6% .17 162.48);--spacing:.25rem;--text-xs:.75rem;--text-xs--line-height:calc(1/.75);--text-sm:.875rem;--text-sm--line-height:calc(1.25/.875);--text-xl:1.25rem;--text-xl--line-height:calc(1.75/1.25);--font-weight-medium:500;--font-weight-semibold:600;--radius-md:.375rem;--radius-lg:.5rem;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4,0,.2,1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-background:#111214;--color-panel:#181a1d;--color-panel-muted:#202328;--color-border:#30343a;--color-foreground:#f2f4f7;--color-muted:#9ba2ad;--color-accent:#75d5a3}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab, red, red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.mx-auto{margin-inline:auto}.mt-1{margin-top:calc(var(--spacing)*1)}.mb-3{margin-bottom:calc(var(--spacing)*3)}.mb-5{margin-bottom:calc(var(--spacing)*5)}.block{display:block}.flex{display:flex}.grid{display:grid}.h-full{height:100%}.min-h-0{min-height:calc(var(--spacing)*0)}.min-h-\[70vh\]{min-height:70vh}.min-h-screen{min-height:100vh}.min-w-0{min-width:calc(var(--spacing)*0)}.flex-1{flex:1}.grid-cols-\[18rem_1fr\]{grid-template-columns:18rem 1fr}.flex-col{flex-direction:column}.place-items-center{place-items:center}.items-center{align-items:center}.items-end{align-items:flex-end}.justify-between{justify-content:space-between}.gap-2{gap:calc(var(--spacing)*2)}.gap-3{gap:calc(var(--spacing)*3)}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing)*2)*var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing)*2)*calc(1 - var(--tw-space-y-reverse)))}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.rounded-full{border-radius:2147483647px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-amber-500\/40{border-color:#f99c0066}@supports (color:color-mix(in lab, red, red)){.border-amber-500\/40{border-color:color-mix(in oklab,var(--color-amber-500)40%,transparent)}}.border-emerald-500\/40{border-color:#00bb7f66}@supports (color:color-mix(in lab, red, red)){.border-emerald-500\/40{border-color:color-mix(in oklab,var(--color-emerald-500)40%,transparent)}}.bg-accent\/15{background-color:#75d5a326}@supports (color:color-mix(in lab, red, red)){.bg-accent\/15{background-color:color-mix(in oklab,var(--color-accent)15%,transparent)}}.bg-background{background-color:var(--color-background)}.bg-panel{background-color:var(--color-panel)}.bg-panel-muted{background-color:var(--color-panel-muted)}.p-2{padding:calc(var(--spacing)*2)}.p-3{padding:calc(var(--spacing)*3)}.p-4{padding:calc(var(--spacing)*4)}.p-6{padding:calc(var(--spacing)*6)}.p-8{padding:calc(var(--spacing)*8)}.px-2{padding-inline:calc(var(--spacing)*2)}.px-3{padding-inline:calc(var(--spacing)*3)}.py-0\.5{padding-block:calc(var(--spacing)*.5)}.py-1\.5{padding-block:calc(var(--spacing)*1.5)}.pb-4{padding-bottom:calc(var(--spacing)*4)}.text-center{text-align:center}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-accent{color:var(--color-accent)}.text-amber-300{color:var(--color-amber-300)}.text-emerald-300{color:var(--color-emerald-300)}.text-foreground{color:var(--color-foreground)}.text-muted{color:var(--color-muted)}.text-red-300{color:var(--color-red-300)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,visibility,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}@media (hover:hover){.hover\:bg-panel-muted:hover{background-color:var(--color-panel-muted)}}}:root{color:var(--color-foreground);background:var(--color-background);font-family:var(--font-sans)}*{border-color:var(--color-border)}body{min-width:320px;min-height:100vh;margin:0}button,a{outline-color:var(--color-accent)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0),var(--tw-enter-translate-y,0),0)scale3d(var(--tw-enter-scale,1),var(--tw-enter-scale,1),var(--tw-enter-scale,1))rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0),var(--tw-exit-translate-y,0),0)scale3d(var(--tw-exit-scale,1),var(--tw-exit-scale,1),var(--tw-exit-scale,1))rotate(var(--tw-exit-rotate,0))}}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}
|