mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-23 09:18:30 +02:00
Rewrote twig grammar
This commit is contained in:
Binary file not shown.
12
src-web/components/DropMarker.tsx
Normal file
12
src-web/components/DropMarker.tsx
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
import React, { memo } from 'react';
|
||||||
|
|
||||||
|
export const DropMarker = memo(
|
||||||
|
function DropMarker() {
|
||||||
|
return (
|
||||||
|
<div className="relative w-full h-0 overflow-visible pointer-events-none">
|
||||||
|
<div className="absolute z-50 left-2 right-2 bottom-[1px] h-[0.2em] bg-blue-500/50 rounded-full" />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
() => true,
|
||||||
|
);
|
||||||
@@ -80,7 +80,7 @@ export function RequestPane({ fullHeight, className }: Props) {
|
|||||||
<TabContent value="params">
|
<TabContent value="params">
|
||||||
<ParametersEditor key={activeRequestId} parameters={[]} onChange={() => null} />
|
<ParametersEditor key={activeRequestId} parameters={[]} onChange={() => null} />
|
||||||
</TabContent>
|
</TabContent>
|
||||||
<TabContent value="body" className="mt-1">
|
<TabContent value="body" className="pl-3 mt-1">
|
||||||
{activeRequest.bodyType === 'json' ? (
|
{activeRequest.bodyType === 'json' ? (
|
||||||
<Editor
|
<Editor
|
||||||
key={activeRequest.id}
|
key={activeRequest.id}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import { IconButton } from './core/IconButton';
|
|||||||
import { ScrollArea } from './core/ScrollArea';
|
import { ScrollArea } from './core/ScrollArea';
|
||||||
import { HStack, VStack } from './core/Stacks';
|
import { HStack, VStack } from './core/Stacks';
|
||||||
import { WindowDragRegion } from './core/WindowDragRegion';
|
import { WindowDragRegion } from './core/WindowDragRegion';
|
||||||
|
import { DropMarker } from './DropMarker';
|
||||||
import { ToggleThemeButton } from './ToggleThemeButton';
|
import { ToggleThemeButton } from './ToggleThemeButton';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -458,14 +459,3 @@ function CustomDragLayer({ sidebarWidth }: { sidebarWidth: number }) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DropMarker = memo(
|
|
||||||
function DropMarker() {
|
|
||||||
return (
|
|
||||||
<div className="relative w-full h-0 overflow-visible pointer-events-none">
|
|
||||||
<div className="absolute z-50 left-2 right-2 bottom-[1px] h-[0.2em] bg-blue-500/50 rounded-full" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
() => true,
|
|
||||||
);
|
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ export function twig(base?: LanguageSupport, autocomplete?: GenericCompletionCon
|
|||||||
if (base) {
|
if (base) {
|
||||||
const completion2 = base.language.data.of({ autocomplete: completions });
|
const completion2 = base.language.data.of({ autocomplete: completions });
|
||||||
const languageSupport2 = new LanguageSupport(base.language, [completion2]);
|
const languageSupport2 = new LanguageSupport(base.language, [completion2]);
|
||||||
return [languageSupport, languageSupport2, placeholders, base.support];
|
return [languageSupport, languageSupport2, base.support];
|
||||||
} else {
|
} else {
|
||||||
return [languageSupport, placeholders];
|
return [languageSupport];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import { styleTags, tags as t } from '@lezer/highlight';
|
import { styleTags, tags as t } from '@lezer/highlight';
|
||||||
|
|
||||||
export const highlight = styleTags({
|
export const highlight = styleTags({
|
||||||
'if endif': t.controlKeyword,
|
Open: t.meta,
|
||||||
'${[ ]}': t.meta,
|
Close: t.meta,
|
||||||
DirectiveContent: t.variableName,
|
Content: t.comment,
|
||||||
|
Template: t.comment,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
@top Template { (directive | Text)* }
|
@top Template { Tag | Text }
|
||||||
|
|
||||||
directive {
|
@local tokens {
|
||||||
Insert
|
Close { "]}" }
|
||||||
|
@else Content
|
||||||
}
|
}
|
||||||
|
|
||||||
@skip {space} {
|
@skip {} {
|
||||||
Insert { "${[" DirectiveContent "]}" }
|
Open { "${[" }
|
||||||
|
Tag { Open (Content)+ Close }
|
||||||
}
|
}
|
||||||
|
|
||||||
@tokens {
|
@tokens {
|
||||||
Text { ![$] Text? }
|
Text { _ }
|
||||||
space { @whitespace+ }
|
|
||||||
DirectiveContent { ![\]}] DirectiveContent? }
|
|
||||||
@precedence { space DirectiveContent }
|
|
||||||
"${[" "]}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@external propSource highlight from "./highlight"
|
@external propSource highlight from "./highlight"
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
||||||
export const
|
export const
|
||||||
Template = 1,
|
Template = 1,
|
||||||
Insert = 2,
|
Tag = 2,
|
||||||
DirectiveContent = 4,
|
Open = 3,
|
||||||
|
Content = 4,
|
||||||
|
Close = 5,
|
||||||
Text = 6
|
Text = 6
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
// This file was generated by lezer-generator. You probably shouldn't edit it.
|
||||||
import {LRParser} from "@lezer/lr"
|
import {LRParser, LocalTokenGroup} from "@lezer/lr"
|
||||||
import {highlight} from "./highlight"
|
import {highlight} from "./highlight"
|
||||||
export const parser = LRParser.deserialize({
|
export const parser = LRParser.deserialize({
|
||||||
version: 14,
|
version: 14,
|
||||||
states: "zQVOPOOO_QQO'#C^OOOO'#Cc'#CcQVOPOOOdQQO,58xOOOO-E6a-E6aOOOO1G.d1G.d",
|
states: "!QOQOPOOOOOO'#C_'#C_OYOQO'#C^QOOOOOOOOO'#Cc'#CcO_OQO,58xOOOO-E6a-E6aOOOO1G.d1G.d",
|
||||||
stateData: "l~OYOS~ORPOUQO~OSSO~OTUO~OYS~",
|
stateData: "g~OUROXPO~OSSO~OSSOTVO~O",
|
||||||
goto: "cWPPXPPPP]TQORQRORTR",
|
goto: "eWPPX[PPP_RRORQOQTQRUT",
|
||||||
nodeNames: "⚠ Template Insert ${[ DirectiveContent ]} Text",
|
nodeNames: "⚠ Template Tag Open Content Close Text",
|
||||||
maxTerm: 10,
|
maxTerm: 9,
|
||||||
propSources: [highlight],
|
propSources: [highlight],
|
||||||
skippedNodes: [0],
|
skippedNodes: [0],
|
||||||
repeatNodeCount: 1,
|
repeatNodeCount: 1,
|
||||||
tokenData: ")gRRmOX!|X^$y^p!|pq$yqt!|tu&}u#P!|#P#Q(k#Q#q!|#q#r$[#r#y!|#y#z$y#z$f!|$f$g$y$g#BY!|#BY#BZ$y#BZ$IS!|$IS$I_$y$I_$I|!|$I|$JO$y$JO$JT!|$JT$JU$y$JU$KV!|$KV$KW$y$KW&FU!|&FU&FV$y&FV;'S!|;'S;=`$s<%lO!|R#TXUPSQOt!|tu#pu#P!|#P#Q$[#Q#q!|#q#r$[#r;'S!|;'S;=`$s<%lO!|Q#uTSQO#P#p#Q#q#p#r;'S#p;'S;=`$U<%lO#pQ$XP;=`<%l#pP$aSUPOt$[u;'S$[;'S;=`$m<%lO$[P$pP;=`<%l$[R$vP;=`<%l!|R%SmUPYQSQOX!|X^$y^p!|pq$yqt!|tu#pu#P!|#P#Q$[#Q#q!|#q#r$[#r#y!|#y#z$y#z$f!|$f$g$y$g#BY!|#BY#BZ$y#BZ$IS!|$IS$I_$y$I_$I|!|$I|$JO$y$JO$JT!|$JT$JU$y$JU$KV!|$KV$KW$y$KW&FU!|&FU&FV$y&FV;'S!|;'S;=`$s<%lO!|R'SVSQO#P#p#Q#o#p#o#p'i#p#q#p#r;'S#p;'S;=`$U<%lO#pR'nVSQO!}#p!}#O(T#O#P#p#Q#q#p#r;'S#p;'S;=`$U<%lO#pR([TRPSQO#P#p#Q#q#p#r;'S#p;'S;=`$U<%lO#pR(pUUPOt$[u#q$[#q#r)S#r;'S$[;'S;=`$m<%lO$[R)ZSTQUPOt$[u;'S$[;'S;=`$m<%lO$[",
|
tokenData: "!S~RTOtbtugu;'Sb;'S;=`z;=`Ob~gOU~~lPU~#o#po~rP!}#Ou~zOX~~!PPU~;=`<%lb",
|
||||||
tokenizers: [0, 1],
|
tokenizers: [1, new LocalTokenGroup("b~RP#P#QU~XP#q#r[~aOT~~", 17, 4)],
|
||||||
topRules: {"Template":[0,1]},
|
topRules: {"Template":[0,1]},
|
||||||
tokenPrec: 25
|
tokenPrec: 0
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import React, { Fragment, memo, useCallback, useEffect, useMemo, useRef, useStat
|
|||||||
import type { XYCoord } from 'react-dnd';
|
import type { XYCoord } from 'react-dnd';
|
||||||
import { useDrag, useDrop } from 'react-dnd';
|
import { useDrag, useDrop } from 'react-dnd';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
|
import { DropMarker } from '../DropMarker';
|
||||||
import type { GenericCompletionConfig } from './Editor/genericCompletion';
|
import type { GenericCompletionConfig } from './Editor/genericCompletion';
|
||||||
import { Icon } from './Icon';
|
import { Icon } from './Icon';
|
||||||
import { IconButton } from './IconButton';
|
import { IconButton } from './IconButton';
|
||||||
@@ -284,14 +285,3 @@ const FormRow = memo(function FormRow({
|
|||||||
const newPairContainer = (pair?: Pair): PairContainer => {
|
const newPairContainer = (pair?: Pair): PairContainer => {
|
||||||
return { pair: pair ?? { name: '', value: '' }, id: uuid() };
|
return { pair: pair ?? { name: '', value: '' }, id: uuid() };
|
||||||
};
|
};
|
||||||
|
|
||||||
const DropMarker = memo(
|
|
||||||
function DropMarker() {
|
|
||||||
return (
|
|
||||||
<div className="relative w-full h-0 overflow-visible pointer-events-none">
|
|
||||||
<div className="absolute z-50 left-0 right-0 bottom-[1px] h-[0.2em] bg-blue-500/50 rounded-full" />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
},
|
|
||||||
() => true,
|
|
||||||
);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user