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
72 changes: 36 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
},
"devDependencies": {
"@lerna/legacy-package-management": "^8.2.4",
"@lvce-editor/eslint-config": "^16.4.0",
"@lvce-editor/eslint-config": "^17.0.3",
"eslint": "^10.7.0",
"lerna": "^8.2.3",
"prettier": "^3.9.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/build/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { join } from 'node:path'
import { pathToFileURL } from 'node:url'
import { root } from './root.ts'

export const threshold = 525_000
export const threshold = 530_000

export const instantiations = 8000

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ interface GetContentRightDomOptions {
readonly visibleLines?: readonly VisibleLine[]
}

const diffEditorInputWrapperNode: VirtualDomNode = {
childCount: 1,
className: ClassNames.DiffEditorInputWrapper,
type: VirtualDomElements.Div,
}

const getInputWrapperDom = (inputValue: string, caretPosition = inputValue.length): readonly VirtualDomNode[] => [
{
childCount: 1,
className: ClassNames.DiffEditorInputWrapper,
type: VirtualDomElements.Div,
},
diffEditorInputWrapperNode,
{
childCount: 0,
className: ClassNames.DiffEditorInput,
Expand Down
12 changes: 7 additions & 5 deletions packages/diff-view/src/parts/GetCursorDom/GetCursorDom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import { VirtualDomElements, type VirtualDomNode } from '@lvce-editor/virtual-do
import * as ClassNames from '../ClassNames/ClassNames.ts'
import { mergeClassNames } from '../MergeClassNames/MergeClassNames.ts'

const diffEditorSelectionsNode: VirtualDomNode = {
childCount: 1,
className: ClassNames.DiffEditorSelections,
type: VirtualDomElements.Div,
}

export const getCursorDom = (): readonly VirtualDomNode[] => {
return [
{
childCount: 1,
className: ClassNames.DiffEditorSelections,
type: VirtualDomElements.Div,
},
diffEditorSelectionsNode,
{
childCount: 0,
className: mergeClassNames(ClassNames.EditorCursor, ClassNames.EditorCursorRight),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ import * as ClassNames from '../ClassNames/ClassNames.ts'
import { getDiffModeToggleDom } from '../GetDiffModeToggleDom/GetDiffModeToggleDom.ts'
import { getWhitespaceToggleDom } from '../GetWhitespaceToggleDom/GetWhitespaceToggleDom.ts'

const diffEditorButtonsNode: VirtualDomNode = {
childCount: 2,
className: ClassNames.DiffEditorButtons,
type: VirtualDomElements.Div,
}

export const getDiffEditorButtonsDom = (diffMode: DiffMode, showWhitespace: boolean): readonly VirtualDomNode[] => {
return [
{
childCount: 2,
className: ClassNames.DiffEditorButtons,
type: VirtualDomElements.Div,
},
...getWhitespaceToggleDom(showWhitespace),
...getDiffModeToggleDom(diffMode),
]
return [diffEditorButtonsNode, ...getWhitespaceToggleDom(showWhitespace), ...getDiffModeToggleDom(diffMode)]
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const getDiffEditorWithSearchDom = (
searchQuery: string,
): readonly VirtualDomNode[] => {
return [
getRootDom(scrollBarActive ? 4 : 3, `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${diffEditorLayoutClass} ${ClassNames.DiffEditorWithSearch}`),
getRootDom(scrollBarActive ? 4 : 3, mergeClassNames(ClassNames.Viewlet, ClassNames.DiffEditor, diffEditorLayoutClass, ClassNames.DiffEditorWithSearch)),
...getDiffSearchHeaderDom(contentLeft, contentRight, searchQuery),
getEditorBodyDom(diffEditorLayoutClass),
...leftDom,
Expand All @@ -66,7 +66,7 @@ const getDiffEditorWithoutSearchDom = (
scrollBarActive: boolean,
): readonly VirtualDomNode[] => {
return [
getRootDom(scrollBarActive ? 5 : 4, `${ClassNames.Viewlet} ${ClassNames.DiffEditor} ${diffEditorLayoutClass}`),
getRootDom(scrollBarActive ? 5 : 4, mergeClassNames(ClassNames.Viewlet, ClassNames.DiffEditor, diffEditorLayoutClass)),
...leftDom,
getSashDom(sashLayoutClass),
...rightDom,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import { VirtualDomElements } from '@lvce-editor/virtual-dom-worker'
import * as ClassNames from '../ClassNames/ClassNames.ts'
import * as DiffStrings from '../DiffStrings/DiffStrings.ts'

const diffSearchHeaderNode: VirtualDomNode = {
childCount: 1,
className: ClassNames.DiffSearchHeader,
type: VirtualDomElements.Div,
}

const countOccurrences = (text: string, query: string): number => {
if (!query) return 0
let count = 0
Expand All @@ -24,11 +30,7 @@ export const getDiffSearchHeaderDom = (contentLeft: string, contentRight: string
const widgetClass = total === 0 && query ? 'DiffSearchWidget DiffSearchWidgetNoResults' : 'DiffSearchWidget'

return [
{
childCount: 1,
className: ClassNames.DiffSearchHeader,
type: VirtualDomElements.Div,
},
diffSearchHeaderNode,
{
childCount: 2,
className: widgetClass,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import type { VirtualDomNode } from '@lvce-editor/virtual-dom-worker'
import { text, VirtualDomElements } from '@lvce-editor/virtual-dom-worker'
import * as ClassNames from '../ClassNames/ClassNames.ts'

const errorCodeFrameLineNode: VirtualDomNode = {
childCount: 1,
type: VirtualDomElements.Div,
}

export const getErrorCodeFrameDom = (codeFrame: string): readonly VirtualDomNode[] => {
if (!codeFrame) {
return []
Expand All @@ -13,12 +18,6 @@ export const getErrorCodeFrameDom = (codeFrame: string): readonly VirtualDomNode
className: ClassNames.DiffEditorErrorCodeFrame,
type: VirtualDomElements.Div,
},
...lines.flatMap((line) => [
{
childCount: 1,
type: VirtualDomElements.Div,
},
text(line),
]),
...lines.flatMap((line) => [errorCodeFrameLineNode, text(line)]),
]
}
12 changes: 7 additions & 5 deletions packages/diff-view/src/parts/GetErrorDom/GetErrorDom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import { getErrorCodeFrameDom } from '../GetErrorCodeFrameDom/GetErrorCodeFrameD
import { getErrorStackDom } from '../GetErrorStackDom/GetErrorStackDom.ts'
import { mergeClassNames } from '../MergeClassNames/MergeClassNames.ts'

const diffEditorErrorMessageNode: VirtualDomNode = {
childCount: 1,
className: ClassNames.DiffEditorErrorMessage,
type: VirtualDomElements.Div,
}

export const getErrorDom = (
contentClassName: string,
errorMessage: string,
Expand All @@ -20,11 +26,7 @@ export const getErrorDom = (
className: mergeClassNames(ClassNames.DiffEditorContent, contentClassName, ClassNames.DiffEditorError),
type: VirtualDomElements.Div,
},
{
childCount: 1,
className: ClassNames.DiffEditorErrorMessage,
type: VirtualDomElements.Div,
},
diffEditorErrorMessageNode,
text(errorMessage),
...getErrorCodeFrameDom(errorCodeFrame),
...getErrorStackDom(errorStack, allowedLinkSchemes),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ import { getStackLineLabel } from '../GetStackLineLabel/GetStackLineLabel.ts'
import { getStackLineLocation } from '../GetStackLineLocation/GetStackLineLocation.ts'
import { getStackLinePrefix } from '../GetStackLinePrefix/GetStackLinePrefix.ts'

const errorStackLineNode: VirtualDomNode = {
childCount: 1,
type: VirtualDomElements.Div,
}

export const getErrorStackLineDom = (stackLine: string, allowedLinkSchemes: readonly string[]): readonly VirtualDomNode[] => {
const location = getStackLineLocation(stackLine)
if (!location) {
return [
{
childCount: 1,
type: VirtualDomElements.Div,
},
text(stackLine),
]
return [errorStackLineNode, text(stackLine)]
}
const prefix = getStackLinePrefix(stackLine)
const href = getStackLineHref(location, allowedLinkSchemes)
Expand Down
12 changes: 7 additions & 5 deletions packages/diff-view/src/parts/GetImageLeftDom/GetImageLeftDom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import * as ClassNames from '../ClassNames/ClassNames.ts'
import * as DomEventListenerFunctions from '../DomEventListenerFunctions/DomEventListenerFunctions.ts'
import { mergeClassNames } from '../MergeClassNames/MergeClassNames.ts'

const imageContentNode: VirtualDomNode = {
childCount: 1,
className: ClassNames.ImageContent,
type: VirtualDomElements.Div,
}

export const getImageLeftDom = (uriLeft: string, imageSrc: string): readonly VirtualDomNode[] => {
return [
{
Expand All @@ -12,11 +18,7 @@ export const getImageLeftDom = (uriLeft: string, imageSrc: string): readonly Vir
onClick: DomEventListenerFunctions.HandleClickLeftSide,
type: VirtualDomElements.Div,
},
{
childCount: 1,
className: ClassNames.ImageContent,
type: VirtualDomElements.Div,
},
imageContentNode,
{
alt: uriLeft,
childCount: 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ import * as ClassNames from '../ClassNames/ClassNames.ts'
import * as DomEventListenerFunctions from '../DomEventListenerFunctions/DomEventListenerFunctions.ts'
import { mergeClassNames } from '../MergeClassNames/MergeClassNames.ts'

const imageContentNode: VirtualDomNode = {
childCount: 1,
className: ClassNames.ImageContent,
type: VirtualDomElements.Div,
}

export const getImageRightDom = (uriRight: string, imageSrc: string): readonly VirtualDomNode[] => {
return [
{
Expand All @@ -12,11 +18,7 @@ export const getImageRightDom = (uriRight: string, imageSrc: string): readonly V
onClick: DomEventListenerFunctions.HandleClickRightSide,
type: VirtualDomElements.Div,
},
{
childCount: 1,
className: ClassNames.ImageContent,
type: VirtualDomElements.Div,
},
imageContentNode,
{
alt: uriRight,
childCount: 0,
Expand Down
Loading