also join complement with perfect and modal

This commit is contained in:
lingdocs 2022-07-10 19:55:19 -05:00
parent 590ed3e0d8
commit 89b4170cd6
5 changed files with 16 additions and 7 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
"version": "3.3.5",
"version": "3.3.6",
"author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com",

View File

@ -103,10 +103,10 @@ function VerbSBlock({ opts, v, script }: {
{"long" in v.ps && <div className="clickable small mb-1" onClick={changeLength}>{length}</div>}
<Border>
<>
{v.type === "verb" && v.complement && <span className="mx-2">
<ComplementBlock opts={opts} comp={v.complement.selection} script={script} inside />
</span>}
{getLength(v.ps, length)[0][script]}
{(v.type === "verb" || v.type === "perfectParticipleBlock") && v.complement && <span className="mx-2">
<ComplementBlock opts={opts} comp={v.complement.selection} script={script} inside />
</span>}
{getLength(v.ps, length)[0][script]}
</>
</Border>
<div>{v.type === "perfectParticipleBlock" ? "Past Partic." : "Verb"}</div>
@ -133,7 +133,12 @@ function ModalVerbBlock({ opts, v, script }: {
return <div className="text-center">
{"long" in v.ps && <div className="clickable small mb-1" onClick={changeLength}>{length}</div>}
<Border>
{getLength(v.ps, length)[0][script]}
<>
{v.complement && <span className="mx-2">
<ComplementBlock opts={opts} comp={v.complement.selection} script={script} inside />
</span>}
{getLength(v.ps, length)[0][script]}
</>
</Border>
<div>Verb</div>
<EnglishBelow>Modal</EnglishBelow>

View File

@ -118,7 +118,7 @@ export function getComplementFromBlocks(blocks: T.Block[][]): T.Rendered<T.Compl
return complement;
}
// maybe there's a complement in the verb block
const verb = blocks[0].find(b => b.block.type === "verb" && b.block)?.block as T.VerbRenderedBlock | undefined;
const verb = getVerbFromBlocks(blocks);
if (verb?.block.complement) {
return verb.block.complement;
}

View File

@ -472,6 +472,7 @@ function splitUpIfModal(v: T.VerbRenderedBlock): [T.VerbRenderedBlock] | [T.Moda
type: "modalVerbBlock",
ps: vrb,
verb: v,
complement: v.block.complement,
},
{
type: "modalVerbKedulPart",
@ -490,6 +491,7 @@ function getPerfectStuff(v: T.SingleOrLengthOpts<T.PsString[]>, vrb: T.VerbRende
ps: p,
person: vrb.block.person,
verb: vrb,
complement: vrb.block.complement,
},
{
type: "perfectEquativeBlock",

View File

@ -904,6 +904,7 @@ export type PerfectParticipleBlock = {
ps: SingleOrLengthOpts<PsString[]>,
verb: VerbRenderedBlock,
person: Person,
complement: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>,
};
export type PerfectEquativeBlock = {
type: "perfectEquativeBlock",
@ -914,6 +915,7 @@ export type ModalVerbBlock = {
type: "modalVerbBlock",
ps: SingleOrLengthOpts<PsString[]>,
verb: VerbRenderedBlock,
complement: undefined | Rendered<ComplementSelection> | Rendered<UnselectedComplementSelection>,
};
export type ModalVerbKedulPart = {
type: "modalVerbKedulPart",