mirror of
https://github.com/anomalyco/opencode.git
synced 2026-08-11 12:23:28 +00:00
Apply PR #38790: feat(app): add workspace flows to new layout
This commit is contained in:
commit
9bed65d50d
64 changed files with 3809 additions and 871 deletions
|
|
@ -10,6 +10,7 @@ const icons = {
|
|||
prompt: `<path d="M14.5841 12.0807H17.9193V2.91406H5.6276V6.2474M14.5859 6.2474H2.08594V15.4141H5.0026V17.4974L8.7526 15.4141H14.5859V6.2474Z" stroke="currentColor" stroke-linecap="square"/>`,
|
||||
brain: `<path d="M13.332 8.7487C11.4911 8.7487 9.9987 7.25631 9.9987 5.41536M6.66536 11.2487C8.50631 11.2487 9.9987 12.7411 9.9987 14.582M9.9987 2.78209L9.9987 17.0658M16.004 15.0475C17.1255 14.5876 17.9154 13.4849 17.9154 12.1978C17.9154 11.3363 17.5615 10.5575 16.9913 9.9987C17.5615 9.43991 17.9154 8.66108 17.9154 7.79962C17.9154 6.21199 16.7136 4.90504 15.1702 4.73878C14.7858 3.21216 13.4039 2.08203 11.758 2.08203C11.1171 2.08203 10.5162 2.25337 9.9987 2.55275C9.48117 2.25337 8.88032 2.08203 8.23944 2.08203C6.59353 2.08203 5.21157 3.21216 4.82722 4.73878C3.28377 4.90504 2.08203 6.21199 2.08203 7.79962C2.08203 8.66108 2.43585 9.43991 3.00609 9.9987C2.43585 10.5575 2.08203 11.3363 2.08203 12.1978C2.08203 13.4849 2.87191 14.5876 3.99339 15.0475C4.46688 16.7033 5.9917 17.9154 7.79962 17.9154C8.61335 17.9154 9.36972 17.6698 9.9987 17.2488C10.6277 17.6698 11.384 17.9154 12.1978 17.9154C14.0057 17.9154 15.5305 16.7033 16.004 15.0475Z" stroke="currentColor"/>`,
|
||||
fork: `<path d="M2.91602 7.91406L2.91602 2.91406H7.91602M12.0827 2.91406H17.0827L17.0827 7.91406M9.99935 9.9974L9.99935 17.0807M9.99935 9.9974L3.33268 3.33073M9.99935 9.9974L16.666 3.33073" stroke="currentColor" stroke-linecap="square"/>`,
|
||||
"workspace-isolated": `<g transform="translate(2 2)"><path d="M10.5 10.5V5.5H5.5V10.5H10.5Z" fill="currentColor"/><rect x="2.5" y="2.5" width="11" height="11" stroke="currentColor"/></g>`,
|
||||
"bullet-list": `<path d="M9.58329 13.7497H17.0833M9.58329 6.24967H17.0833M6.24996 6.24967C6.24996 7.17015 5.50377 7.91634 4.58329 7.91634C3.66282 7.91634 2.91663 7.17015 2.91663 6.24967C2.91663 5.3292 3.66282 4.58301 4.58329 4.58301C5.50377 4.58301 6.24996 5.3292 6.24996 6.24967ZM6.24996 13.7497C6.24996 14.6701 5.50377 15.4163 4.58329 15.4163C3.66282 15.4163 2.91663 14.6701 2.91663 13.7497C2.91663 12.8292 3.66282 12.083 4.58329 12.083C5.50377 12.083 6.24996 12.8292 6.24996 13.7497Z" stroke="currentColor" stroke-linecap="square"/>`,
|
||||
"check-small": `<path d="M6.5 11.4412L8.97059 13.5L13.5 6.5" stroke="currentColor" stroke-linecap="square"/>`,
|
||||
"chevron-down": `<path d="M6.6665 8.33325L9.99984 11.6666L13.3332 8.33325" stroke="currentColor" stroke-linecap="square"/>`,
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
import { createContext, useContext, type Accessor, type ParentProps } from "solid-js"
|
||||
import { I18nProvider } from "@kobalte/core/i18n"
|
||||
import { dict as en } from "../i18n/en"
|
||||
import type { Key, LocaleKey, PluralCategory, PluralKey, PluralLookupKey } from "../i18n/en"
|
||||
|
||||
export type UiI18nKey = keyof typeof en
|
||||
|
||||
export const UI_PLURAL_KEYS = [
|
||||
"ui.sessionTurn.diffs.changed",
|
||||
"ui.messagePart.context.read",
|
||||
"ui.messagePart.context.search",
|
||||
"ui.messagePart.context.list",
|
||||
] as const
|
||||
export type UiI18nPluralKey = (typeof UI_PLURAL_KEYS)[number]
|
||||
export type UiPluralCategory = "zero" | "one" | "two" | "few" | "many" | "other"
|
||||
export type UiI18nPluralLookupKey = `${UiI18nPluralKey}.${UiPluralCategory}`
|
||||
export type UiI18nKey = Key
|
||||
export type UiI18nPluralKey = PluralKey
|
||||
export type UiPluralCategory = PluralCategory
|
||||
export type UiI18nPluralLookupKey = PluralLookupKey
|
||||
export type UiI18nLocaleKey = LocaleKey
|
||||
type UiTranslationKey<Key extends string> = Key extends UiI18nPluralLookupKey ? never : Key
|
||||
|
||||
export type UiI18nParams = Record<string, string | number | boolean>
|
||||
export type UiTranslate = <Key extends string>(key: UiTranslationKey<Key>, params?: UiI18nParams) => string
|
||||
|
||||
export type UiI18n = {
|
||||
locale: Accessor<string>
|
||||
layoutLocale?: Accessor<string>
|
||||
t: (key: UiI18nKey, params?: UiI18nParams) => string
|
||||
t: UiTranslate
|
||||
plural: (key: UiI18nPluralKey, count: number, params?: UiI18nParams) => string
|
||||
pluralForm?: (key: UiI18nPluralKey, category: UiPluralCategory, params?: UiI18nParams) => string
|
||||
}
|
||||
|
||||
const rules = new Map<string, Intl.PluralRules>()
|
||||
|
|
@ -50,11 +48,16 @@ function resolveTemplate(text: string, params?: UiI18nParams) {
|
|||
const fallback: UiI18n = {
|
||||
locale: () => "en",
|
||||
t: (key, params) => {
|
||||
const value = en[key] ?? String(key)
|
||||
const value = en[key as UiI18nKey] ?? String(key)
|
||||
return resolveTemplate(value, params)
|
||||
},
|
||||
plural: (key, count, params) =>
|
||||
fallback.t(pluralKey(key, pluralCategory(fallback.locale(), count)), { ...params, count }),
|
||||
fallback.pluralForm!(key, pluralCategory(fallback.locale(), count), { ...params, count }),
|
||||
pluralForm: (key, category, params) => {
|
||||
const values = en as Partial<Record<UiI18nLocaleKey, string>>
|
||||
const value = values[pluralKey(key, category)] ?? values[`${key}.other`] ?? `${key}.other`
|
||||
return resolveTemplate(value, params)
|
||||
},
|
||||
}
|
||||
|
||||
const Context = createContext<UiI18n>(fallback)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
export const dict: Record<string, string> = {
|
||||
const source = {
|
||||
"ui.sessionReview.title": "Session changes",
|
||||
"ui.sessionReview.title.git": "Git changes",
|
||||
"ui.sessionReview.title.branch": "Branch changes",
|
||||
|
|
@ -217,4 +217,13 @@ export const dict: Record<string, string> = {
|
|||
"ui.question.multiHint": "Select all answers that apply",
|
||||
"ui.question.singleHint": "Select one answer",
|
||||
"ui.question.custom.placeholder": "Type your answer...",
|
||||
}
|
||||
} satisfies Record<string, string>
|
||||
|
||||
export type Key = keyof typeof source
|
||||
export type PluralCategory = "zero" | "one" | "two" | "few" | "many" | "other"
|
||||
export type PluralKey = {
|
||||
[Entry in Key]: Entry extends `${infer Base}.other` ? (`${Base}.one` extends Key ? Base : never) : never
|
||||
}[Key]
|
||||
export type PluralLookupKey = `${PluralKey}.${PluralCategory}`
|
||||
export type LocaleKey = Key | PluralLookupKey
|
||||
export const dict: typeof source & Record<string, string> = source
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@
|
|||
[data-slot="dialog-description"] {
|
||||
flex: none;
|
||||
flex-grow: 0;
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
overflow-wrap: anywhere;
|
||||
user-select: none;
|
||||
font-weight: 440;
|
||||
font-size: 13px;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { onMount, type ComponentProps, splitProps } from "solid-js"
|
||||
|
||||
// Consumers center the SVG viewport, so each icon must center its artwork within its viewBox.
|
||||
const icons = {
|
||||
edit: {
|
||||
viewBox: "0 0 16 16",
|
||||
|
|
@ -17,6 +18,10 @@ const icons = {
|
|||
viewBox: "0 0 16 16",
|
||||
body: `<path d="M5.118 5.686V10.314M5.118 5.686C5.97 5.686 6.661 4.995 6.661 4.143C6.661 3.291 5.97 2.6 5.118 2.6C4.266 2.6 3.575 3.291 3.575 4.143C3.575 4.995 4.266 5.686 5.118 5.686ZM5.118 10.314C4.266 10.314 3.575 11.005 3.575 11.857C3.575 12.709 4.266 13.4 5.118 13.4C5.97 13.4 6.661 12.709 6.661 11.857M5.118 10.314C5.97 10.314 6.661 11.005 6.661 11.857M10.882 5.686C11.734 5.686 12.425 4.995 12.425 4.143C12.425 3.291 11.734 2.6 10.882 2.6C10.03 2.6 9.339 3.291 9.339 4.143C9.339 4.995 10.03 5.686 10.882 5.686ZM10.882 5.686V9.457C10.882 10.783 9.807 11.857 8.482 11.857H6.661" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"/>`,
|
||||
},
|
||||
"branch-out": {
|
||||
viewBox: "0 0 16 16",
|
||||
body: `<path d="M10.4225 3.35355L12.9024 5.83344L10.4225 8.31333" stroke="currentColor"/><path d="M1 12.2852H4.23042C4.89912 12.2852 5.52359 11.951 5.89452 11.3946L9.00783 6.72462C8.37877 6.16823 10.0032 5.83402 10.6719 5.83402H12.9024" stroke="currentColor"/><path d="M8.5 12.2852H14" stroke="currentColor" stroke-linejoin="round"/>`,
|
||||
},
|
||||
"grid-plus": {
|
||||
viewBox: "0 0 16 16",
|
||||
body: `<path d="M13.9948 11.668H9.32812M11.6641 9.33203V13.9987M6.66667 9.33203V13.9987H2V9.33203H6.66667ZM6.66667 2V6.66667H2V2H6.66667ZM13.9948 2V6.66667H9.32812V2H13.9948Z" stroke="currentColor" stroke-miterlimit="10" stroke-linecap="square"/>`,
|
||||
|
|
@ -121,6 +126,14 @@ const icons = {
|
|||
viewBox: "0 0 20 20",
|
||||
body: `<path d="M7 14.5H13M7 7.99512H10.0049M10.0049 7.99512H13M10.0049 7.99512V5M10.0049 7.99512V11M18 18V2L2 2L2 18H18Z" stroke="currentColor"/>`,
|
||||
},
|
||||
"window-analytics": {
|
||||
viewBox: "0 0 16 16",
|
||||
body: `<g transform="translate(1 2)"><path d="M7 4H11M7 8H11M0.5 0.5V11.5H13.5V0.5H0.5ZM3.5 3.5H4.5V4.5H3.5V3.5ZM3.5 7.5H4.5V8.5H3.5V7.5Z" stroke="currentColor" stroke-miterlimit="10" stroke-linecap="square"/></g>`,
|
||||
},
|
||||
trash: {
|
||||
viewBox: "0 0 20 20",
|
||||
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"/>`,
|
||||
},
|
||||
"outline-sliders": {
|
||||
viewBox: "0 0 16 16",
|
||||
body: `<path d="M11.7779 4.66675H14.4446M11.7779 4.66675C11.7779 5.77132 10.8825 6.66675 9.77789 6.66675C8.67332 6.66675 7.77789 5.77132 7.77789 4.66675M11.7779 4.66675C11.7779 3.56218 10.8825 2.66675 9.77789 2.66675C8.67332 2.66675 7.77789 3.56218 7.77789 4.66675M1.55566 4.66675H7.77789M4.22233 11.3334H1.55566M4.22233 11.3334C4.22233 12.438 5.11776 13.3334 6.22233 13.3334C7.3269 13.3334 8.22233 12.438 8.22233 11.3334M4.22233 11.3334C4.22233 10.2288 5.11776 9.33341 6.22233 9.33341C7.3269 9.33341 8.22233 10.2288 8.22233 11.3334M14.4446 11.3334H8.22233" stroke="currentColor"/>`,
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ export function TooltipV2(props: TooltipV2Props) {
|
|||
"value",
|
||||
])
|
||||
|
||||
const controlled = () => local.forceOpen !== undefined
|
||||
const inside = () => {
|
||||
const active = document.activeElement
|
||||
if (!ref || !active) return false
|
||||
|
|
@ -119,9 +120,9 @@ export function TooltipV2(props: TooltipV2Props) {
|
|||
{...others}
|
||||
closeDelay={0}
|
||||
ignoreSafeArea={local.ignoreSafeArea ?? true}
|
||||
open={local.forceOpen || state.open}
|
||||
open={controlled() ? local.forceOpen : state.open}
|
||||
onOpenChange={(open) => {
|
||||
if (local.forceOpen) return
|
||||
if (controlled()) return
|
||||
if (state.block && open) return
|
||||
if (justClickedTrigger) {
|
||||
justClickedTrigger = false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue