Skip to content

Commit

Permalink
Correct frontend errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hunter-richardson committed Jun 23, 2024
1 parent d23a253 commit 8458da2
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 54 deletions.
5 changes: 5 additions & 0 deletions src/extensions/string.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ declare global {
startsWithVowel(): boolean;
removeMacra(): string;
capitalize(): string;
isCapitalized(): boolean;
}
}

Expand Down Expand Up @@ -50,3 +51,7 @@ String.prototype.removeMacra = function (): string {
String.prototype.capitalize = function (): string {
return (this.at(0) ?? '').toUpperCase().concat(this.slice(1));
};

String.prototype.isCapitalized = function(): boolean {
return /[A-ZĀĒĪŌȲ]/.test(this.at(0) ?? '');
}
14 changes: 7 additions & 7 deletions src/facies/calculare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
};
const actus: string[][] = [
[ ' I ', ' C ', ' · ', ' + ' ],
[ ' V ', ' D ', ' : ', ' - ' ],
[ ' X ', ' M ', '', '' ],
[ ' L ', ' | ', ' × ', ' ÷ ' ],
[ ' = ', ' N ', ' S ', ' % ' ]
[ 'I', 'C', '·', '+' ],
[ 'V', 'D', ':', '-' ],
[ 'X', 'M', '', '' ],
[ 'L', '|', '×', '÷' ],
[ '=', 'N', 'S', '%' ]
];
export default defineComponent({
Expand Down Expand Up @@ -130,9 +130,9 @@
<v-card :text='praesentes.romanus' />
<div class='text-center' v-for='linea in actus' :key='linea'>
<span class='text-center' v-for='littera in linea' :key='littera'>
<v-card :text='littera' :id='`actus_${littera.trim()}`'
<v-card :text=` ${littera} ` :id='`actus_${littera}`'
:disabled='licta(littera)' density='comfortable'
@click='ponatur(littera.trim());'
@click='ponatur(littera);'
position='absolute' border hover />
</span>
</div>
Expand Down
6 changes: 2 additions & 4 deletions src/facies/gustulare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
import { defineComponent } from 'vue'
import Gustulus from '../scriptura/gustulus'
defineProps({ gustulus: Gustulus });
export default defineComponent({ props: [ 'gustulus' ] })
export default defineComponent({ props: { gustulus: Gustulus } })
</script>

<template>
Expand All @@ -12,7 +11,6 @@
v-model="gustulus.visibile"
:color="gustulus.color"
:timeout="gustulus.vita"
:text="gustulus.nuntium"
/>
:text="gustulus.nuntium" />
</template>
</template>
46 changes: 31 additions & 15 deletions src/facies/inflectere.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
<script setup lang='ts' generic='Hoc extends Multiplex'>
import { defineComponent } from 'vue';
import Tabula from '../tabulae/tabula';
import type { Faciendum } from '../praebeunda/interfecta';
import type { Eventus } from '../miscella/dictionarium';
defineProps<Hoc>({ eventus: Eventus });
defineProps<{
eventus: {
referendum: Faciendum<Hoc>,
categoria: string
}
}>();
type Columnae = {
title: string,
key: string,
filter: (verbum: Hoc, colamen: string) => boolean
}[];
const agendum: Faciendum<Hoc> = eventus.value?.referendum as Faciendum<Hoc>;
const agendum: Faciendum<Hoc> = eventus.value?.referendum;

Check failure on line 18 in src/facies/inflectere.vue

View workflow job for this annotation

GitHub Actions / aedificare

Cannot find name 'eventus'. Did you mean 'event'?
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const tabula: Tabula<Hoc> | null = agendum?.putetur() ?? null;
const categoria: string = eventus.value?.categoria ?? '';

Check failure on line 22 in src/facies/inflectere.vue

View workflow job for this annotation

GitHub Actions / aedificare

Cannot find name 'eventus'. Did you mean 'event'?
const anglica: boolean = Cocutor.se.ipse().edatur('lingua') === 'anglica';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const columnae: Columnae = Multiplex.colamina(categoria).map(columna => {
return {
title: (anglica ? anglicum(columna) : columna).toUpperCase(),
Expand All @@ -44,14 +49,14 @@
figura = 'nomenActum';
break;
case agendum instanceof Agenda.NumeramenAgendum:
// eslint-disable-next-line @typescript-eslint/no-unused-vars
figura = 'numeramenAgendum';
break;
}
</script>

<script lang='ts'>
import type { ModelRef } from 'vue';
import { defineModel } from 'vue';
import { defineComponent, defineModel, type ModelRef } from 'vue';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import specere from './specere.vue';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand All @@ -63,6 +68,7 @@
import Cocutor from '../miscella/cocutor';
// eslint-disable-next-line @typescript-eslint/no-unused-vars
import { genera, gradi, anglicum } from '../miscella/enumerationes';
import type { Referendum } from '../praebeunda/interfecta'
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const verbum: ModelRef<Verbum | undefined, string> = defineModel<Verbum>('verbum');
Expand Down Expand Up @@ -200,17 +206,27 @@
referendum: referendum,
categoria: eventus.categoria
};
};
}
}
}, async mounted (): Promise<void> {
this.haec = await omnes();
this.haec = await this.omnes();
switch (this.haec?.length ?? 0) {
case 1:
this.verbum = this.haec.first();
break;
case 0:
break;
default:
this.seligenda = [
...new Set((this.haec as Hoc[])
.map(verbum => verbum.valores())
.map(valor => Object.values(valor))
.flat())
];
this.seligenda = [
...new Set((this.haec as Hoc[])
.map(verbum => verbum.valores())
.map(valor => Object.values(valor))
.flat())
];
break;
}
return new Promise(() => this.onerans = false);
}
Expand All @@ -222,7 +238,7 @@
<template v-if='verbum'>
<specere :verbum='verbum' @blur='verbum = undefined;' />
</template>
<template v-else>
<template v-else-if='eventus'>
<div id='colamina'>
<horizontal-scroll>
<v-chip-group v-for='seligendum in seligenda' :key='seligendum'
Expand Down
77 changes: 56 additions & 21 deletions src/facies/specere.vue
Original file line number Diff line number Diff line change
@@ -1,43 +1,50 @@
<script lang='ts'>
import { defineComponent, defineModel } from 'vue';
import { defineComponent, defineModel, type ModelRef } from 'vue';
import Gustulus from '../scriptura/gustulus';
import gustulare from './gustulare.vue';
import { Verbum, Multiplex, Actus, Numerus } from '../praebeunda/verba';
import Locutor from '../miscella/locutor';
import inflectere from './inflectere.vue';
import Cocutor from '../miscella/cocutor';
import { Encliticum } from '../miscella/enumerationes';
import type { Eventus } from '../miscella/dictionarium';
import type { NumeramenAgendum } from '../praebeunda/agenda';
import type { ModelRef } from 'vue';
import Gustulus from '../scriptura/gustulus';
import gustulare from './gustulare.vue';
const eventus: ModelRef<Eventus | undefined, string> = defineModel<Eventus>('eventus');
const lingua: string | undefined = Cocutor.se.ipse().edatur('lingua');
const multiplex: boolean = false;
const valores: string[] = []
defineProps({ verbum: Verbum });
const locutor: Locutor = Locutor.se.ipse();
export default defineComponent({
components: { gustulare, inflectere },
props: [ 'verbum' ],
props: { verbum: Verbum },
data() {
data (): {
gustulus: Gustulus,
eventus: Eventus | undefined,
anglica: boolean,
propriabile: boolean,
multiplex: boolean,
valores: string[],
enclitica: string[],
encliticum: string
} {
return {
gustulus: new Gustulus({}),
eventus: eventus.value,
anglica: lingua === 'anglica',
multiplex: multiplex,
valores: valores,
locutor: Locutor.se.ipse()
propriabile: false,
multiplex: false,
valores: [],
enclitica: Object.keys(Encliticum),
encliticum: ''
};
},
methods: {
async aperi (): Promise<void> {
switch (this.verbum?.categoria) {
case 'actus': {
const actus: Actus = verbum as Actus;
const actus: Actus = this.verbum as Actus;
if (actus.modus === 'participium') {
this.eventus = {
referendum: await actus.participialis(),
Expand All @@ -48,7 +55,7 @@
break;
}
case 'numerus': {
const numerus: Numerus = verbum as Numerus;
const numerus: Numerus = this.verbum as Numerus;
const agendum: NumeramenAgendum | null = await numerus.numeramen();
if (agendum) {
this.eventus = {
Expand All @@ -59,12 +66,33 @@
break;
}
}
}, adde (): void {
if (this.verbum) {
if ([ this.multiplex, this.encliticum ].all()) {
(this.verbum as Multiplex).encliticum = this.encliticum;
}
locutor.addatur(this.verbum);
}
}, addeProprium (): void {
if ([ this.verbum, this.propriabile ].all()) {
this.verbum.scriptum = this.verbum.scriptum.capitalize();

Check failure on line 79 in src/facies/specere.vue

View workflow job for this annotation

GitHub Actions / aedificare

Object is possibly 'undefined'.

Check failure on line 79 in src/facies/specere.vue

View workflow job for this annotation

GitHub Actions / aedificare

Object is possibly 'undefined'.
}
this.adde();
}
},
mounted(): void {
this.multiplex = this.verbum.value instanceof Multiplex;
this.valores = this.multiplex ? (this.verbum.value as Multiplex)?.valores() : [];
this.multiplex = this.verbum ? this.verbum instanceof Multiplex : false;
this.valores = this.multiplex ? (this.verbum as Multiplex)?.valores() : [];
this.propriabile = [
this.multiplex, [
'nomen', 'adiectivum'
].includes(verbum?.categoria),

Check failure on line 93 in src/facies/specere.vue

View workflow job for this annotation

GitHub Actions / aedificare

Cannot find name 'verbum'. Did you mean 'Verbum'?
!verbum?.scriptum.isCapitalized()

Check failure on line 94 in src/facies/specere.vue

View workflow job for this annotation

GitHub Actions / aedificare

Cannot find name 'verbum'. Did you mean 'Verbum'?
].all();
}
});
</script>
Expand All @@ -81,13 +109,20 @@
<v-chip v-for='valor in valores' :key='valor' :text='valor' :id="`valor_${valor}`"
selected-class='text-primary' prepend-icon='category' />
</v-chip-group>
<v-select density='compact' id='enclitica' v-model='encliticum'
:title="anglica ? 'Enclitics' : 'Enclitica'"
:items='enclitica' chips flat open-on-clear />
</template>
<v-btn-toggle>
<template v-if='verbum?.paratumne()'>
<v-btn icon='chat_add_on' :text="anglica ? 'Add this to my phrase' : 'Adde hoc locutioni'"
id='adde' @click='locutor.addatur(verbum as Verbum);' />
<v-btn icon='chat_add_on' id='adde' @click='adde();'
:text="anglica ? 'Add this to my phrase' : 'Adde hoc locutioni'" />
</template>
<template v-if='propriabile'>
<v-bnt icon='chat_add_on' id='addeProprium' @click='addeProprium();'
:text="anglica ? 'Add this to my phrase as a proper name' : 'Adde hoc locutioni ut proprium'" />
</template>
<template v-if="verbum?.categoria === 'numerus'">
<template v-else-if="verbum?.categoria === 'numerus'">
<v-btn icon='quick_reference' id='aperi' @click='aperi();' :text="anglica ? 'Open' : 'Refer'" />
</template>
<template v-else-if="verbum?.categoria === 'actus' &&
Expand Down
1 change: 0 additions & 1 deletion src/miscella/enumerationes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export enum Encliticum {
Nolens = '',
Interrogans = 'ne',
Coniugans = 'que',
Eligens = 've'
Expand Down
22 changes: 16 additions & 6 deletions src/praebeunda/verba.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import Structor from './structor';
import LectorVerbalis from '../lectores/verbalis';
import * as Enumerationes from '../miscella/enumerationes';
import Numerator from '../miscella/numerator';
import { AdiectivumAgendum, NumeramenAgendum, type Agendum, type Positor } from './agenda';
import Structor from './structor';

export class Verbum {
static readonly Errator: (exemplar: string, res: string) => Error = (
exemplar: string,
res: string
) => new Error(["Malu'st", exemplar, res].join(' '));

readonly unicum: symbol = Symbol();
categoria: string = '';
protected _scriptum: string = '';
Expand Down Expand Up @@ -83,19 +84,28 @@ export abstract class Multiplex extends Verbum {
}
}

private _encliticum: string = Enumerationes.Encliticum.Nolens;
private _encliticum: string = '';

abstract valores(): string[];

get encliticum(): string {
return this._encliticum;
}

set encliticum(valor: Enumerationes.Encliticum) {
this._encliticum = valor;
set encliticum (valor: string) {
if ([
!valor,
Object.keys(Enumerationes.Encliticum).includes(valor ?? '')
].any()) {
if (this._encliticum) {
this.scriptum = this.scriptum.replace(`${this._encliticum}$`, '');
}

this._encliticum = valor ?? '';

if (valor) {
this.scriptum = this.scriptum.concat(valor);
if (this._encliticum) {
this.scriptum = this.scriptum.concat(this._encliticum);
}
}
}
}
Expand Down

0 comments on commit 8458da2

Please sign in to comment.