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", "name": "@lingdocs/pashto-inflector",
"version": "3.3.5", "version": "3.3.6",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "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>} {"long" in v.ps && <div className="clickable small mb-1" onClick={changeLength}>{length}</div>}
<Border> <Border>
<> <>
{v.type === "verb" && v.complement && <span className="mx-2"> {(v.type === "verb" || v.type === "perfectParticipleBlock") && v.complement && <span className="mx-2">
<ComplementBlock opts={opts} comp={v.complement.selection} script={script} inside /> <ComplementBlock opts={opts} comp={v.complement.selection} script={script} inside />
</span>} </span>}
{getLength(v.ps, length)[0][script]} {getLength(v.ps, length)[0][script]}
</> </>
</Border> </Border>
<div>{v.type === "perfectParticipleBlock" ? "Past Partic." : "Verb"}</div> <div>{v.type === "perfectParticipleBlock" ? "Past Partic." : "Verb"}</div>
@ -133,7 +133,12 @@ function ModalVerbBlock({ opts, v, script }: {
return <div className="text-center"> return <div className="text-center">
{"long" in v.ps && <div className="clickable small mb-1" onClick={changeLength}>{length}</div>} {"long" in v.ps && <div className="clickable small mb-1" onClick={changeLength}>{length}</div>}
<Border> <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> </Border>
<div>Verb</div> <div>Verb</div>
<EnglishBelow>Modal</EnglishBelow> <EnglishBelow>Modal</EnglishBelow>

View File

@ -118,7 +118,7 @@ export function getComplementFromBlocks(blocks: T.Block[][]): T.Rendered<T.Compl
return complement; return complement;
} }
// maybe there's a complement in the verb block // 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) { if (verb?.block.complement) {
return verb.block.complement; return verb.block.complement;
} }

View File

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

View File

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