update VPDisplay

This commit is contained in:
lingdocs 2022-07-05 16:42:43 -05:00
parent f770a93270
commit 27f5019bbd
4 changed files with 11 additions and 5 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@lingdocs/pashto-inflector",
"version": "3.2.4",
"version": "3.2.5",
"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

@ -10,16 +10,18 @@ import CompiledPTextDisplay from "../CompiledPTextDisplay";
import RenderedBlocksDisplay from "../RenderedBlocksDisplay";
import useStickyState from "../../lib/useStickyState";
function VPDisplay({ VPS, opts, setForm, justify, onlyOne, length }: {
function VPDisplay({ VPS, opts, setForm, justify, onlyOne, length, mode: preferredMode, script: preferredScript }: {
VPS: T.VPSelectionState,
opts: T.TextOptions,
setForm: "disable" | ((form: T.FormVersion) => void),
justify?: "left" | "right" | "center",
onlyOne?: boolean | "concat",
length?: "long" | "short",
mode?: Mode,
script?: "p" | "f"
}) {
const [mode, setMode] = useState<Mode>("text");
const [script, setScript] = useStickyState<"p" | "f">("f", "blockScriptChoice");
const [mode, setMode] = useState<Mode>(preferredMode || "text");
const [script, setScript] = useStickyState<"p" | "f">(preferredScript || "f", "blockScriptChoice");
const VP = completeVPSelection(VPS);
if (!VP) {
return <div className="lead text-muted text-center mt-4">

View File

@ -34,6 +34,8 @@ import useStickyState from "./lib/useStickyState";
import { isPastTense } from "./lib/phrase-building/vp-tools";
import Block, { NPBlock, APBlock } from "./components/blocks/Block";
import { roleIcon } from "./components/vp-explorer/VPExplorerExplanationModal";
import CompiledPTextDisplay from "./components/CompiledPTextDisplay";
import RenderedBlocksDisplay from "./components/RenderedBlocksDisplay";
import {
makePsString,
removeFVarients,
@ -266,6 +268,8 @@ export {
VPDisplay,
EPPicker,
VPPicker,
CompiledPTextDisplay,
RenderedBlocksDisplay,
// OTHER
typePredicates,
grammarUnits,

File diff suppressed because one or more lines are too long