Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions apps/dotcom/client/public/tla/locales-compiled/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,12 @@
"value": "Unsupported Mermaid diagram"
}
],
"402bf0c47e": [
{
"type": 0,
"value": "Color theme"
}
],
"42e53c47c1": [
{
"type": 0,
Expand Down Expand Up @@ -599,6 +605,12 @@
"value": "Submit an issue on GitHub"
}
],
"7a1920d611": [
{
"type": 0,
"value": "Default"
}
],
"7b1329f5ca": [
{
"type": 0,
Expand Down
6 changes: 6 additions & 0 deletions apps/dotcom/client/public/tla/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,9 @@
"3e2ae04ff0": {
"translation": "Unsupported Mermaid diagram"
},
"402bf0c47e": {
"translation": "Color theme"
},
"42e53c47c1": {
"translation": "Contact the owner to request access."
},
Expand Down Expand Up @@ -278,6 +281,9 @@
"797799f35e": {
"translation": "Submit an issue on GitHub"
},
"7a1920d611": {
"translation": "Default"
},
"7b1329f5ca": {
"translation": "User manual"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

.cta {
background-color: var(--tla-color-cta);
color: #ffffff;
color: var(--tla-color-contrast);
font-weight: 600;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
padding: 0px 16px;
font-size: 12px;
font-weight: 600;
color: #ffffff;
color: var(--tla-color-contrast);
border: none;
cursor: pointer;
}
Expand All @@ -39,7 +39,7 @@
content: '';
position: absolute;
inset: 0px;
color: #ffffff;
color: var(--tla-color-contrast);
background-color: var(--tla-color-cta);
border-radius: 6px;
z-index: 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,27 @@ import classNames from 'classnames'
import { useCallback, useEffect, useRef, useState } from 'react'
import { Link, useParams } from 'react-router-dom'
import {
AccessibilityMenu,
ColorSchemeMenu,
DefaultPageMenu,
EditSubmenu,
ExportFileContentSubMenu,
ExtrasGroup,
InputModeMenu,
KeyboardShortcutsMenuItem,
LanguageMenu,
PreferencesGroup,
ToggleDebugModeItem,
ToggleDynamicSizeModeItem,
ToggleEdgeScrollingItem,
ToggleFocusModeItem,
ToggleGridItem,
TogglePasteAtCursorItem,
TldrawUiButton,
TldrawUiButtonLabel,
ToggleSnapModeItem,
ToggleToolLockItem,
ToggleWrapModeItem,
TldrawUiDropdownMenuContent,
TldrawUiDropdownMenuRoot,
TldrawUiDropdownMenuTrigger,
Expand All @@ -35,6 +49,7 @@ import {
GiveUsFeedbackMenuItem,
LegalSummaryMenuItem,
UserManualMenuItem,
UIThemeSubmenu,
} from '../menu-items/menu-items'
import { FileItems, TlaFileMenu } from '../TlaFileMenu/TlaFileMenu'
import { TlaIcon } from '../TlaIcon/TlaIcon'
Expand Down Expand Up @@ -138,7 +153,7 @@ export function TlaEditorTopLeftPanelAnonymous() {
<TldrawUiMenuActionItem actionId={'save-file-copy'} />
{canCopyToApp && <TldrawUiMenuActionItem actionId={'copy-to-my-files'} />}
</TldrawUiMenuGroup>
<PreferencesGroup />
<TlaPreferencesGroup />
<TldrawUiMenuGroup id="misc">
<UserManualMenuItem />
<GiveUsFeedbackMenuItem />
Expand Down Expand Up @@ -415,3 +430,33 @@ function SignInMenuItem() {
</TldrawUiButton>
)
}

function TlaPreferencesGroup() {
return (
<TldrawUiMenuGroup id="preferences">
<TldrawUiMenuSubmenu id="preferences" label="menu.preferences">
<TldrawUiMenuGroup id="preferences-actions">
<ToggleSnapModeItem />
<ToggleToolLockItem />
<ToggleGridItem />
<ToggleWrapModeItem />
<ToggleFocusModeItem />
<ToggleEdgeScrollingItem />
<ToggleDynamicSizeModeItem />
<TogglePasteAtCursorItem />
</TldrawUiMenuGroup>
<TldrawUiMenuGroup id="user-interface-submenus">
<ColorSchemeMenu />
<UIThemeSubmenu />
<AccessibilityMenu />
<InputModeMenu />
</TldrawUiMenuGroup>
<TldrawUiMenuGroup id="debug">
<ToggleDebugModeItem />
</TldrawUiMenuGroup>
</TldrawUiMenuSubmenu>
<LanguageMenu />
<KeyboardShortcutsMenuItem />
</TldrawUiMenuGroup>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
width: 100%;
height: 32px;
background-color: var(--tla-color-cta);
color: white;
color: var(--tla-color-contrast);
border: none;
border-radius: var(--tl-radius-1);
font-weight: 500;
Expand Down
16 changes: 10 additions & 6 deletions apps/dotcom/client/src/tla/components/menu-items/menu-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ const messages = defineMessages({
manageCookies: { defaultMessage: 'Manage cookies' },
about: { defaultMessage: 'About tldraw' },
submitFeedback: { defaultMessage: 'Send feedback' },
// color theme
colorTheme: { defaultMessage: 'Color theme' },
colorThemeDefault: { defaultMessage: 'Default' },
// debug
appDebugFlags: { defaultMessage: 'App debug flags' },
langAccented: { defaultMessage: 'i18n: Accented' },
Expand Down Expand Up @@ -90,10 +93,9 @@ export function ColorThemeSubmenu() {
return <ColorSchemeMenu />
}

const THEME_NAMES: Record<string, string> = {
default: 'Default',
...Object.fromEntries(UI_THEMES.map(({ id, name }) => [id, name])),
}
const THEME_NAMES: Record<string, string> = Object.fromEntries(
UI_THEMES.map(({ id, name }) => [id, name])
)

function UIThemeMenuCheckboxItem({
checked,
Expand Down Expand Up @@ -140,6 +142,8 @@ export function UIThemeSubmenu() {
const colorTheme = useValue('colorTheme', () => getLocalSessionState().colorTheme, [])
const trackEvent = useTldrawAppUiEvents()
const clearThemePreview = useCallback(() => setColorThemePreview(null), [])
const colorThemeLabel = useMsg(messages.colorTheme)
const defaultThemeLabel = useMsg(messages.colorThemeDefault)

const themeIds = useValue('themeIds', () => (editor ? Object.keys(editor.getThemes()) : []), [
editor,
Expand All @@ -150,7 +154,7 @@ export function UIThemeSubmenu() {
if (!editor || themeIds.length === 0) return null

return (
<TldrawUiMenuSubmenu id="ui-theme" label="menu.color-theme">
<TldrawUiMenuSubmenu id="ui-theme" label={colorThemeLabel}>
<div
className="tlui-menu__group"
onPointerCancel={clearThemePreview}
Expand All @@ -159,7 +163,7 @@ export function UIThemeSubmenu() {
{themeIds.map((id) => (
<UIThemeMenuCheckboxItem
key={id}
label={THEME_NAMES[id] ?? id}
label={id === 'default' ? defaultThemeLabel : (THEME_NAMES[id] ?? id)}
checked={colorTheme === id}
onPreview={() => setColorThemePreview(id)}
onSelect={() => {
Expand Down
28 changes: 14 additions & 14 deletions apps/dotcom/client/src/tla/themes/ui-themes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#f8f8f2',
'tla-color-text-2': '#e0e0dc',
'tla-color-text-3': '#6272a4',
'tla-color-contrast': '#f8f8f2',
'tla-color-contrast': '#ffffff',
'tla-color-low': '#343746',
'tla-color-border': '#565971',
'tla-color-hover-1': 'hsla(60, 30%, 96%, 0.03)',
Expand Down Expand Up @@ -428,7 +428,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#e5e9f0',
'tla-color-text-2': '#d8dee9',
'tla-color-text-3': '#7b88a1',
'tla-color-contrast': '#eceff4',
'tla-color-contrast': '#2e3440',
'tla-color-low': '#353c4a',
'tla-color-border': '#434c5e',
'tla-color-hover-1': 'hsla(218, 27%, 92%, 0.03)',
Expand Down Expand Up @@ -474,7 +474,7 @@ const THEMES: UITheme[] = [
'tl-color-low-border': '#e5e5e0',
'tl-color-divider': '#d6d6d0',
'tl-color-selected': '#66d9ef',
'tl-color-selected-contrast': '#272822',
'tl-color-selected-contrast': '#f7f7f7',
'tl-color-primary': '#66d9ef',
'tl-color-focus': '#66d9ef',
'tl-color-muted-none': 'hsla(60, 6%, 26%, 0)',
Expand All @@ -483,7 +483,7 @@ const THEMES: UITheme[] = [
'tl-color-muted-2': 'hsla(60, 6%, 26%, 0.043)',
'tl-color-hint': 'hsla(60, 6%, 26%, 0.055)',
'tl-color-overlay': 'hsla(60, 6%, 26%, 0.2)',
'tl-color-tooltip': '#272822',
'tl-color-tooltip': '#f7f7f7',
'tl-color-success': '#a6e22e',
'tl-color-info': '#66d9ef',
'tl-color-warning': '#fd971f',
Expand All @@ -503,7 +503,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#383830',
'tla-color-text-2': '#49483e',
'tla-color-text-3': '#8f908a',
'tla-color-contrast': '#fafafa',
'tla-color-contrast': '#f7f7f7',
'tla-color-low': '#f0f0ec',
'tla-color-border': '#d6d6d0',
'tla-color-hover-1': 'hsla(60, 6%, 26%, 0.03)',
Expand Down Expand Up @@ -572,7 +572,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#f8f8f2',
'tla-color-text-2': '#e6e6e0',
'tla-color-text-3': '#75715e',
'tla-color-contrast': '#f8f8f2',
'tla-color-contrast': '#272822',
'tla-color-low': '#2f302a',
'tla-color-border': '#49483e',
'tla-color-hover-1': 'hsla(60, 30%, 96%, 0.03)',
Expand Down Expand Up @@ -860,7 +860,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#cdd6f4',
'tla-color-text-2': '#bac2de',
'tla-color-text-3': '#6c7086',
'tla-color-contrast': '#cdd6f4',
'tla-color-contrast': '#1e1e2e',
'tla-color-low': '#28283a',
'tla-color-border': '#45475a',
'tla-color-hover-1': 'hsla(226, 64%, 88%, 0.03)',
Expand Down Expand Up @@ -1004,7 +1004,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#dcdfe4',
'tla-color-text-2': '#abb2bf',
'tla-color-text-3': '#5c6370',
'tla-color-contrast': '#dcdfe4',
'tla-color-contrast': '#282c34',
'tla-color-low': '#2c313a',
'tla-color-border': '#3e4451',
'tla-color-hover-1': 'hsla(219, 14%, 71%, 0.03)',
Expand Down Expand Up @@ -1148,7 +1148,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#c0caf5',
'tla-color-text-2': '#a9b1d6',
'tla-color-text-3': '#565f89',
'tla-color-contrast': '#c0caf5',
'tla-color-contrast': '#1a1b26',
'tla-color-low': '#1f2030',
'tla-color-border': '#2f3350',
'tla-color-hover-1': 'hsla(226, 33%, 75%, 0.03)',
Expand Down Expand Up @@ -1292,7 +1292,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#e0d5bb',
'tla-color-text-2': '#d3c6aa',
'tla-color-text-3': '#7a8478',
'tla-color-contrast': '#e0d5bb',
'tla-color-contrast': '#2d353b',
'tla-color-low': '#313b40',
'tla-color-border': '#3d484d',
'tla-color-hover-1': 'hsla(40, 28%, 73%, 0.03)',
Expand Down Expand Up @@ -1436,7 +1436,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#f0f6fc',
'tla-color-text-2': '#c9d1d9',
'tla-color-text-3': '#484f58',
'tla-color-contrast': '#f0f6fc',
'tla-color-contrast': '#0d1117',
'tla-color-low': '#12171e',
'tla-color-border': '#21262d',
'tla-color-hover-1': 'hsla(210, 29%, 80%, 0.03)',
Expand Down Expand Up @@ -1580,7 +1580,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#ececec',
'tla-color-text-2': '#cecdc3',
'tla-color-text-3': '#575653',
'tla-color-contrast': '#ececec',
'tla-color-contrast': '#fffcf0',
'tla-color-low': '#161514',
'tla-color-border': '#282726',
'tla-color-hover-1': 'hsla(40, 5%, 79%, 0.03)',
Expand Down Expand Up @@ -1724,7 +1724,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#d6deeb',
'tla-color-text-2': '#b0bec5',
'tla-color-text-3': '#5f7e97',
'tla-color-contrast': '#d6deeb',
'tla-color-contrast': '#011627',
'tla-color-low': '#071e31',
'tla-color-border': '#13344f',
'tla-color-hover-1': 'hsla(208, 44%, 84%, 0.03)',
Expand Down Expand Up @@ -1868,7 +1868,7 @@ const THEMES: UITheme[] = [
'tla-color-text-1': '#ffffff',
'tla-color-text-2': '#ffffff',
'tla-color-text-3': '#aaaaaa',
'tla-color-contrast': '#ffffff',
'tla-color-contrast': '#000000',
'tla-color-low': '#0a0a0a',
'tla-color-border': '#ffffff',
'tla-color-hover-1': 'hsla(0, 0%, 100%, 0.03)',
Expand Down
3 changes: 3 additions & 0 deletions packages/tldraw/api-report.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -2467,6 +2467,9 @@ export class ImageShapeUtil extends BaseBoxShapeUtil<TLImageShape> {
export interface ImageShapeUtilDisplayValues {
}

// @public (undocumented)
export function InputModeMenu(): JSX.Element;

// @public (undocumented)
export const KeyboardShiftEnterTweakExtension: Extension<any, any>;

Expand Down
1 change: 1 addition & 0 deletions packages/tldraw/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ export {
} from './lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialog'
export { DefaultKeyboardShortcutsDialogContent } from './lib/ui/components/KeyboardShortcutsDialog/DefaultKeyboardShortcutsDialogContent'
export { LanguageMenu } from './lib/ui/components/LanguageMenu'
export { InputModeMenu } from './lib/ui/components/InputModeMenu'
export {
DefaultMainMenu,
type TLUiMainMenuProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class EditingShape extends StateNode {
this.parent.setCurrentToolIdMask('text')
}

this.editor.setCursor({ type: 'default', rotation: 0 })
updateHoveredShapeId(this.editor)
this.editor.select(editingShape)
}
Expand Down
5 changes: 3 additions & 2 deletions packages/tldraw/src/lib/ui/hooks/useKeyboardShortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ export function useKeyboardShortcuts() {

editor.inputs.keys.delete('Comma')

const { x, y, z } = editor.inputs.getCurrentScreenPoint()
const { x, y, z } = editor.inputs.getCurrentPagePoint()
const screenPoint = editor.pageToScreen({ x, y })
const info: TLPointerEventInfo = {
type: 'pointer',
name: 'pointer_up',
point: { x, y, z },
point: { x: screenPoint.x, y: screenPoint.y, z },
shiftKey: e.shiftKey,
altKey: e.altKey,
ctrlKey: e.metaKey || e.ctrlKey,
Expand Down
Loading
Loading