Change shared files naming. Rework tree structure and item management rendering.

This commit is contained in:
Clément Pons
2026-01-20 18:14:07 +01:00
parent 1a71637ebb
commit 777443471c
66 changed files with 984 additions and 447 deletions

View File

@@ -11,9 +11,9 @@
</template>
<script setup lang="ts">
import { Content } from '#shared/content.util';
import * as Floating from '#shared/floating.util';
import { Toaster } from '#shared/components.util';
import { Content } from '~~/shared/content';
import * as Floating from '~~/shared/floating';
import { Toaster } from '~~/shared/components';
import { init } from '#shared/i18n';
onBeforeMount(() => {

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import render, { type MDProperties } from '#shared/markdown.util'
import render, { type MDProperties } from '~~/shared/markdown'
const { content, filter, properties } = defineProps<{
content?: string,
filter?: string,

View File

@@ -52,11 +52,11 @@
<script setup lang="ts">
import { Icon } from '@iconify/vue';
import { TreeDOM } from '#shared/tree';
import { Content, iconByType } from '#shared/content.util';
import { dom, icon } from '#shared/dom.util';
import { unifySlug } from '#shared/general.util';
import { tooltip } from '#shared/floating.util';
import { link, loading } from '#shared/components.util';
import { Content, iconByType } from '~~/shared/content';
import { dom, icon } from '~~/shared/dom';
import { unifySlug } from '~~/shared/general';
import { tooltip } from '~~/shared/floating';
import { link, loading } from '~~/shared/components';
const open = ref(false);
let tree: TreeDOM | undefined;

View File

@@ -1,4 +1,4 @@
import { hasPermissions } from "#shared/auth.util";
import { hasPermissions } from "#shared/auth";
export default defineNuxtRouteMiddleware(async (to, from) => {
const { loggedIn, fetch, user } = useUserSession();

View File

@@ -31,10 +31,10 @@
</script>
<script setup lang="ts">
import { format } from '#shared/general.util';
import { iconByType } from '#shared/content.util';
import { format } from '~~/shared/general';
import { iconByType } from '~~/shared/content';
import { Icon } from '@iconify/vue';
import { Toaster } from '#shared/components.util';
import { Toaster } from '~~/shared/components';
interface File
{

View File

@@ -15,7 +15,7 @@ const schemaList: Record<string, z.ZodObject<any> | null> = {
<script setup lang="ts">
import { z } from 'zod/v4';
import { Icon } from '@iconify/vue';
import { Toaster } from '#shared/components.util';
import { Toaster } from '~~/shared/components';
definePageMeta({
rights: ['admin'],

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { unifySlug } from '#shared/general.util';
import { CampaignSheet } from '#shared/campaign.util';
import { unifySlug } from '~~/shared/general';
import { CampaignSheet } from '~~/shared/campaign';
definePageMeta({
requiresAuth: true,

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { Toaster } from '#shared/components.util';
import { Toaster } from '~~/shared/components';
definePageMeta({
requiresAuth: true,

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { CharacterBuilder } from '#shared/character.util';
import { unifySlug } from '#shared/general.util';
import { CharacterBuilder } from '~~/shared/character';
import { unifySlug } from '~~/shared/general';
definePageMeta({
requiresAuth: true,

View File

@@ -1,8 +1,8 @@
<script setup lang="ts">
import characterConfig from '#shared/character-config.json';
import { unifySlug } from '#shared/general.util';
import { unifySlug } from '~~/shared/general';
import type { CharacterConfig } from '~/types/character';
import { CharacterSheet } from '#shared/character.util';
import { CharacterSheet } from '~~/shared/character';
/*
text-light-red dark:text-dark-red border-light-red dark:border-dark-red bg-light-red dark:bg-dark-red

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import characterConfig from '#shared/character-config.json';
import { Toaster } from '#shared/components.util';
import { Toaster } from '~~/shared/components';
import type { CharacterConfig } from '~/types/character';
definePageMeta({

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { HomebrewBuilder } from '#shared/feature.util';
import { HomebrewBuilder } from '#shared/feature';
definePageMeta({

View File

@@ -7,8 +7,8 @@
</template>
<script setup lang="ts">
import { Content } from '#shared/content.util';
import { unifySlug } from '#shared/general.util';
import { Content } from '~~/shared/content';
import { unifySlug } from '~~/shared/general';
const element = useTemplateRef('element'), overview = ref();
const route = useRouter().currentRoute;

View File

@@ -47,11 +47,11 @@
</template>
<script setup lang="ts">
import { Content, Editor } from '#shared/content.util';
import { button, loading } from '#shared/components.util';
import { dom, icon } from '#shared/dom.util';
import { modal, tooltip } from '#shared/floating.util';
import { Toaster } from '#shared/components.util';
import { Content, Editor } from '~~/shared/content';
import { button, loading } from '~~/shared/components';
import { dom, icon } from '~~/shared/dom';
import { modal, tooltip } from '~~/shared/floating';
import { Toaster } from '~~/shared/components';
import { Icon } from '@iconify/vue';
definePageMeta({

View File

@@ -25,7 +25,7 @@
<script setup lang="ts">
import { Icon } from '@iconify/vue';
import { Toaster } from '#shared/components.util';
import { Toaster } from '~~/shared/components';
definePageMeta({
layout: 'login',

View File

@@ -26,7 +26,7 @@
<script setup lang="ts">
import { Icon } from '@iconify/vue';
import { Toaster } from '#shared/components.util';
import { Toaster } from '~~/shared/components';
definePageMeta({
layout: 'login',

View File

@@ -21,7 +21,7 @@
import type { ZodError } from 'zod/v4';
import { schema, type Login } from '~/schemas/login';
import { Icon } from '@iconify/vue';
import { Toaster } from '#shared/components.util';
import { Toaster } from '~~/shared/components';
definePageMeta({
layout: 'login',

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { hasPermissions } from "#shared/auth.util";
import { Toaster } from '#shared/components.util';
import { hasPermissions } from "#shared/auth";
import { Toaster } from '~~/shared/components';
definePageMeta({
requiresAuth: true,

View File

@@ -31,7 +31,7 @@
import { ZodError } from 'zod/v4';
import { schema, type Registration } from '~/schemas/registration';
import { Icon } from '@iconify/vue';
import { Toaster } from '#shared/components.util';
import { Toaster } from '~~/shared/components';
definePageMeta({
layout: 'login',

View File

@@ -1,4 +1,4 @@
import type { MAIN_STATS, ABILITIES, LEVELS, TRAINING_LEVELS, SPELL_TYPES, CATEGORIES, SPELL_ELEMENTS, ALIGNMENTS, RESISTANCES, DAMAGE_TYPES, WEAPON_TYPES, PropertySum, ITEM_BUFFER_KEYS } from "#shared/character.util";
import type { MAIN_STATS, ABILITIES, LEVELS, TRAINING_LEVELS, SPELL_TYPES, CATEGORIES, SPELL_ELEMENTS, ALIGNMENTS, RESISTANCES, DAMAGE_TYPES, WEAPON_TYPES, PropertySum, ITEM_BUFFER_KEYS } from "#shared/character";
import type { Localized } from "../types/general";
export type MainStat = typeof MAIN_STATS[number];
@@ -57,11 +57,19 @@ export type CharacterVariables = {
money: number;
};
export enum TreeFlag {
AUTOMATIC = 1 << 0,
REPEATING = 1 << 1,
};
export type TreeLeaf = {
id: FeatureID;
to?: FeatureID | Array<FeatureID> | Record<string, FeatureID>;
flags?: number; //Flags from TreeFlag
};
export type TreeStructure = {
name: string;
nodes: FeatureID[];
paths: Record<number, number | number[]>;
starts: FeatureID;
nodes: Record<FeatureID, TreeLeaf>;
};
type CommonState = {
capacity?: number;
@@ -212,7 +220,7 @@ export type FeatureTree = {
id: FeatureID;
category: "tree";
tree: string;
option?: number;
option?: string;
};
export type FeatureChoice = {
id: FeatureID;