@opencode/ui 0.0.0-dev-98 → 0.0.0-dev-106
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/components/document-surface.d.ts +3 -0
- package/dist/components/preview-controls.d.ts +9 -0
- package/dist/i18n/en.d.ts +4 -0
- package/dist/icons/catalog.d.ts +16 -0
- package/package.json +3 -2
- package/src/components/document-surface.css +37 -0
- package/src/components/document-surface.tsx +6 -0
- package/src/components/preview-controls.css +28 -0
- package/src/components/preview-controls.tsx +53 -0
- package/src/i18n/en.ts +4 -0
- package/src/icons/catalog.ts +16 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "./preview-controls.css";
|
|
2
|
+
export declare function PreviewControls(props: {
|
|
3
|
+
onZoomIn: () => void;
|
|
4
|
+
onZoomOut: () => void;
|
|
5
|
+
onFit: () => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
zoomInDisabled?: boolean;
|
|
8
|
+
zoomOutDisabled?: boolean;
|
|
9
|
+
}): import("solid-js").JSX.Element;
|
package/dist/i18n/en.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
declare const source: {
|
|
2
|
+
"ui.preview.controls": string;
|
|
3
|
+
"ui.preview.zoomIn": string;
|
|
4
|
+
"ui.preview.zoomOut": string;
|
|
5
|
+
"ui.preview.fit": string;
|
|
2
6
|
"ui.sessionReview.title": string;
|
|
3
7
|
"ui.sessionReview.title.git": string;
|
|
4
8
|
"ui.sessionReview.title.branch": string;
|
package/dist/icons/catalog.d.ts
CHANGED
|
@@ -68,6 +68,14 @@ declare const icons: {
|
|
|
68
68
|
viewBox: string;
|
|
69
69
|
body: string;
|
|
70
70
|
};
|
|
71
|
+
"outline-magnifier-minus": {
|
|
72
|
+
viewBox: string;
|
|
73
|
+
body: string;
|
|
74
|
+
};
|
|
75
|
+
"outline-magnifier-plus": {
|
|
76
|
+
viewBox: string;
|
|
77
|
+
body: string;
|
|
78
|
+
};
|
|
71
79
|
menu: {
|
|
72
80
|
viewBox: string;
|
|
73
81
|
body: string;
|
|
@@ -148,6 +156,10 @@ declare const icons: {
|
|
|
148
156
|
viewBox: string;
|
|
149
157
|
body: string;
|
|
150
158
|
};
|
|
159
|
+
"outline-expand": {
|
|
160
|
+
viewBox: string;
|
|
161
|
+
body: string;
|
|
162
|
+
};
|
|
151
163
|
filetree: {
|
|
152
164
|
viewBox: string;
|
|
153
165
|
body: string;
|
|
@@ -176,6 +188,10 @@ declare const icons: {
|
|
|
176
188
|
viewBox: string;
|
|
177
189
|
body: string;
|
|
178
190
|
};
|
|
191
|
+
"outline-code-brackets": {
|
|
192
|
+
viewBox: string;
|
|
193
|
+
body: string;
|
|
194
|
+
};
|
|
179
195
|
trash: {
|
|
180
196
|
viewBox: string;
|
|
181
197
|
body: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencode/ui",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-106",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"import": "./src/layout/divider/divider.tsx",
|
|
72
72
|
"types": "./dist/layout/divider/divider.d.ts"
|
|
73
73
|
},
|
|
74
|
+
"./document-surface.css": "./src/components/document-surface.css",
|
|
74
75
|
"./field": {
|
|
75
76
|
"import": "./src/forms/field/field.tsx",
|
|
76
77
|
"types": "./dist/forms/field/field.d.ts"
|
|
@@ -286,7 +287,7 @@
|
|
|
286
287
|
"dependencies": {
|
|
287
288
|
"@kitlangton/solid-motion": "0.2.2",
|
|
288
289
|
"@kobalte/core": "0.13.13",
|
|
289
|
-
"@opencode/util": "0.0.0-dev-
|
|
290
|
+
"@opencode/util": "0.0.0-dev-106",
|
|
290
291
|
"@pierre/diffs": "1.6.1",
|
|
291
292
|
"@pierre/highlights": "0.2.0",
|
|
292
293
|
"@solid-primitives/event-listener": "2.4.6",
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
[data-component="document-surface"] {
|
|
2
|
+
position: relative;
|
|
3
|
+
border-radius: 8px;
|
|
4
|
+
background: var(--v2-background-bg-base);
|
|
5
|
+
box-shadow: var(--v2-elevation-raised);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Paint the border above page bitmaps without changing their dimensions or text coordinates. */
|
|
9
|
+
[data-component="document-surface"]::after {
|
|
10
|
+
content: "";
|
|
11
|
+
position: absolute;
|
|
12
|
+
inset: 0;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
border: 0.5px solid var(--v2-border-border-base);
|
|
15
|
+
border-radius: inherit;
|
|
16
|
+
pointer-events: none;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* The raised token paints outside the sheet; retain its top edge in flush scrollports. */
|
|
20
|
+
[data-document-surface-inset] {
|
|
21
|
+
padding-block-start: 1px;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
[data-document-surface-scrollport] {
|
|
25
|
+
--document-surface-gutter: 20px;
|
|
26
|
+
scrollbar-gutter: stable;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[data-document-surface-column] {
|
|
30
|
+
padding-inline: var(--document-surface-gutter, 20px);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
@container (max-width: 600px) {
|
|
34
|
+
[data-document-surface-scrollport] {
|
|
35
|
+
--document-surface-gutter: 12px;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[data-component="preview-controls"] {
|
|
2
|
+
position: absolute;
|
|
3
|
+
inset-inline-end: 12px;
|
|
4
|
+
bottom: 12px;
|
|
5
|
+
z-index: 2;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: row;
|
|
8
|
+
align-items: center;
|
|
9
|
+
padding: 4px;
|
|
10
|
+
border: 0.5px solid var(--v2-border-border-base);
|
|
11
|
+
border-radius: 8px;
|
|
12
|
+
background: var(--v2-background-bg-base);
|
|
13
|
+
box-shadow: var(--v2-elevation-raised);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
[data-slot="preview-controls-divider"] {
|
|
17
|
+
width: 0.5px;
|
|
18
|
+
height: 20px;
|
|
19
|
+
margin-inline: 4px;
|
|
20
|
+
background: var(--v2-border-border-base);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@media (pointer: coarse) {
|
|
24
|
+
[data-component="preview-controls"] [data-component="icon-button-v2"] {
|
|
25
|
+
width: 44px;
|
|
26
|
+
height: 44px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Icon } from "@opencode/ui/icon"
|
|
2
|
+
import { IconButton } from "@opencode/ui/icon-button"
|
|
3
|
+
import { Tooltip } from "@opencode/ui/tooltip"
|
|
4
|
+
import { useI18n } from "../context/i18n"
|
|
5
|
+
import "./preview-controls.css"
|
|
6
|
+
|
|
7
|
+
export function PreviewControls(props: {
|
|
8
|
+
onZoomIn: () => void
|
|
9
|
+
onZoomOut: () => void
|
|
10
|
+
onFit: () => void
|
|
11
|
+
disabled?: boolean
|
|
12
|
+
zoomInDisabled?: boolean
|
|
13
|
+
zoomOutDisabled?: boolean
|
|
14
|
+
}) {
|
|
15
|
+
const i18n = useI18n()
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<div data-component="preview-controls" role="group" aria-label={i18n.t("ui.preview.controls")}>
|
|
19
|
+
<Tooltip value={i18n.t("ui.preview.zoomIn")} placement="top">
|
|
20
|
+
<IconButton
|
|
21
|
+
variant="ghost-muted"
|
|
22
|
+
size="large"
|
|
23
|
+
aria-label={i18n.t("ui.preview.zoomIn")}
|
|
24
|
+
disabled={props.disabled || props.zoomInDisabled}
|
|
25
|
+
onClick={props.onZoomIn}
|
|
26
|
+
icon={<Icon name="outline-magnifier-plus" size="normal" />}
|
|
27
|
+
/>
|
|
28
|
+
</Tooltip>
|
|
29
|
+
<span data-slot="preview-controls-divider" aria-hidden />
|
|
30
|
+
<Tooltip value={i18n.t("ui.preview.zoomOut")} placement="top">
|
|
31
|
+
<IconButton
|
|
32
|
+
variant="ghost-muted"
|
|
33
|
+
size="large"
|
|
34
|
+
aria-label={i18n.t("ui.preview.zoomOut")}
|
|
35
|
+
disabled={props.disabled || props.zoomOutDisabled}
|
|
36
|
+
onClick={props.onZoomOut}
|
|
37
|
+
icon={<Icon name="outline-magnifier-minus" size="normal" />}
|
|
38
|
+
/>
|
|
39
|
+
</Tooltip>
|
|
40
|
+
<span data-slot="preview-controls-divider" aria-hidden />
|
|
41
|
+
<Tooltip value={i18n.t("ui.preview.fit")} placement="top">
|
|
42
|
+
<IconButton
|
|
43
|
+
variant="ghost-muted"
|
|
44
|
+
size="large"
|
|
45
|
+
aria-label={i18n.t("ui.preview.fit")}
|
|
46
|
+
disabled={props.disabled}
|
|
47
|
+
onClick={props.onFit}
|
|
48
|
+
icon={<Icon name="outline-expand" size="normal" />}
|
|
49
|
+
/>
|
|
50
|
+
</Tooltip>
|
|
51
|
+
</div>
|
|
52
|
+
)
|
|
53
|
+
}
|
package/src/i18n/en.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
const source = {
|
|
2
|
+
"ui.preview.controls": "Preview controls",
|
|
3
|
+
"ui.preview.zoomIn": "Zoom in",
|
|
4
|
+
"ui.preview.zoomOut": "Zoom out",
|
|
5
|
+
"ui.preview.fit": "Fit",
|
|
2
6
|
"ui.sessionReview.title": "Session changes",
|
|
3
7
|
"ui.sessionReview.title.git": "Git changes",
|
|
4
8
|
"ui.sessionReview.title.branch": "Branch changes",
|
package/src/icons/catalog.ts
CHANGED
|
@@ -70,6 +70,14 @@ const icons = {
|
|
|
70
70
|
viewBox: "0 0 16 16",
|
|
71
71
|
body: `<path d="M14 14L10.3454 10.3454M6.88889 11.7778C9.58889 11.7778 11.7778 9.58889 11.7778 6.88889C11.7778 4.18889 9.58889 2 6.88889 2C4.18889 2 2 4.18889 2 6.88889C2 9.58889 4.18889 11.7778 6.88889 11.7778Z" stroke="currentColor"/>`,
|
|
72
72
|
},
|
|
73
|
+
"outline-magnifier-minus": {
|
|
74
|
+
viewBox: "0 0 16 16",
|
|
75
|
+
body: `<path d="M14 14L11 11M4.66667 7.33333H10M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" stroke-miterlimit="10" stroke-linecap="square" stroke="currentColor"/>`,
|
|
76
|
+
},
|
|
77
|
+
"outline-magnifier-plus": {
|
|
78
|
+
viewBox: "0 0 16 16",
|
|
79
|
+
body: `<path d="M14 14L11 11M4.66667 7.33333H10M7.33333 4.66667V10M12.6667 7.33333C12.6667 10.2789 10.2789 12.6667 7.33333 12.6667C4.38781 12.6667 2 10.2789 2 7.33333C2 4.38781 4.38781 2 7.33333 2C10.2789 2 12.6667 4.38781 12.6667 7.33333Z" stroke-miterlimit="10" stroke-linecap="square" stroke="currentColor"/>`,
|
|
80
|
+
},
|
|
73
81
|
menu: {
|
|
74
82
|
viewBox: "0 0 16 16",
|
|
75
83
|
body: `<path d="M2 8H14M2 4.664H14M2 11.336H14" stroke="currentColor"/>`,
|
|
@@ -150,6 +158,10 @@ const icons = {
|
|
|
150
158
|
viewBox: "0 0 16 16",
|
|
151
159
|
body: `<path d="M8.25 6.17773V1.17773M11.25 4.17773L8.25 1.17773L5.25 4.17773" stroke="currentColor"/><path d="M8.25 9.17773V14.1777M11.25 11.1777L8.25 14.1777L5.25 11.1777" stroke="currentColor"/><path d="M4.25 7.67773H12.25" stroke="currentColor"/>`,
|
|
152
160
|
},
|
|
161
|
+
"outline-expand": {
|
|
162
|
+
viewBox: "0 0 24 24",
|
|
163
|
+
body: `<g transform="scale(1.2)" stroke="currentColor" stroke-width="1.25"><path d="M4.58301 10.4163V15.4163H9.58301M10.4163 4.58301H15.4163V9.58301" stroke="currentColor" stroke-linecap="square"/></g>`,
|
|
164
|
+
},
|
|
153
165
|
filetree: {
|
|
154
166
|
viewBox: "0 0 16 16",
|
|
155
167
|
body: `<path d="M2.5 1.5V12.2484H6.75M2.5 4.74838H6.75" stroke="currentColor"/><rect x="8.5" y="3.2168" width="6" height="3" fill="none" stroke="currentColor"/><rect x="8.5" y="10.75" width="6" height="3" fill="none" stroke="currentColor"/>`,
|
|
@@ -178,6 +190,10 @@ const icons = {
|
|
|
178
190
|
viewBox: "0 0 16 16",
|
|
179
191
|
body: `<path fill-rule="evenodd" clip-rule="evenodd" d="M10.0812 2.10803L6.55974 14.0809L5.92016 13.8928L9.44161 1.91992L10.0812 2.10803ZM4.13793 4.97275L1.44666 8.00045L4.13793 11.0281L3.63966 11.471L0.554688 8.00045L3.63966 4.52984L4.13793 4.97275ZM12.3617 4.52984L15.4467 8.00045L12.3617 11.471L11.8634 11.0281L14.5547 8.00045L11.8634 4.97275L12.3617 4.52984Z" fill="currentColor"/>`,
|
|
180
192
|
},
|
|
193
|
+
"outline-code-brackets": {
|
|
194
|
+
viewBox: "0 0 16 16",
|
|
195
|
+
body: `<path d="M5 4L1 8L5 12M11 4L15 8L11 12M9 1L7 15" stroke="currentColor"/>`,
|
|
196
|
+
},
|
|
181
197
|
trash: {
|
|
182
198
|
viewBox: "0 0 20 20",
|
|
183
199
|
body: `<path d="M4.58342 17.9134L4.58369 17.4134L4.22787 17.5384L4.22766 18.0384H4.58342V17.9134ZM15.4167 17.9134V18.0384H15.7725L15.7723 17.5384L15.4167 17.9134ZM2.08342 3.95508V3.45508H1.58342V3.95508H2.08342V4.45508V3.95508ZM17.9167 4.45508V4.95508H18.4167V4.45508H17.9167V3.95508V4.45508ZM4.16677 4.58008L3.66701 4.5996L4.22816 17.5379L4.72792 17.4934L5.22767 17.4489L4.66652 4.54055L4.16677 4.58008ZM4.58342 18.0384V17.9134H15.4167V18.0384V18.5384H4.58342V18.0384ZM15.4167 17.9134L15.8332 17.5379L16.2498 4.5996L15.7501 4.58008L15.2503 4.56055L14.8337 17.4989L15.4167 17.9134ZM15.8334 4.58008V4.08008H4.16677V4.58008V5.08008H15.8334V4.58008ZM2.08342 4.45508V4.95508H4.16677V4.58008V4.08008H2.08342V4.45508ZM15.8334 4.58008V5.08008H17.9167V4.45508V3.95508H15.8334V4.58008ZM6.83951 4.35149L7.432 4.55047C7.79251 3.47701 8.80699 2.70508 10.0001 2.70508V2.20508V1.70508C8.25392 1.70508 6.77335 2.83539 6.24702 4.15251L6.83951 4.35149ZM10.0001 2.20508V2.70508C11.1932 2.70508 12.2077 3.47701 12.5682 4.55047L13.1607 4.35149L13.7532 4.15251C13.2269 2.83539 11.7463 1.70508 10.0001 1.70508V2.20508Z" fill="currentColor"/>`,
|