Files
Forge-Engine/document_engine/__init__.py
T
williamandClaude Sonnet 5 746feb3796 Ajoute l'alignement vertical du contenu d'une page, réglable depuis l'onglet "Pages"
Nouvelle colonne _document_pages.vertical_align (top/center/bottom,
"top" par défaut, migration incluse pour les supports existants).
Quand l'onglet "Pages" du panneau gauche est actif, le panneau
Propriétés (droite) affiche maintenant l'alignement de la page active
au lieu des propriétés d'un élément — un contrôle segmenté qui persiste
via une nouvelle route dédiée et met à jour le canevas immédiatement.

Le contenu-seed des thèmes porte désormais aussi ce réglage par page
(seed_pages devient une liste de {vertical_align, blocks} plutôt qu'une
liste de listes de blocs) : la page de titre du thème "Sécurité
Incendie" est centrée verticalement, comme demandé, cohérente avec la
maquette d'origine. L'aperçu de thème (iframe de la modale) reflète
aussi ce réglage par page.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-24 10:24:48 +02:00

139 lines
4.7 KiB
Python

"""
document_engine — support de formation : entité racine séparée du jeu 2D
(voir docs/plan/PLAN.md). Un support est composé de plusieurs PAGES (voir
document_engine/pages/, retour utilisateur du 21/09/2026 : "il faut
implémenter un système de page") ; chaque page structure son propre
contenu en deux couches sur le même canevas :
le flux de contenu (titre/paragraphe/image/bouton/mini-jeux), organisé en
rangées ("row") par le moteur d'inférence de layout (voir
document_engine/rendering/render_document_element.py).
Tout est stocké dans support.db (voir db/supports/) : _document_pages (une
ligne par page) et _document_elements (chaque élément appartient à
exactement une page via page_id, avec parent_id NULL au top-niveau ou
enfant d'une rangée).
Aucun import croisé avec game_engine ou tout module lié au jeu 2D — voir
le contrat import-linter dans pyproject.toml (game_engine | document_engine
sont un même palier, mutuellement isolés).
Ce module se contente de ré-exporter l'intégralité de l'API publique du
paquet (pattern "un fichier = une fonction, un dossier = une responsabi-
lité", voir game_engine/__init__.py).
"""
from .elements.add_document_element import add_document_element
from .elements.delete_document_element import delete_document_element
from .elements.get_document_element import get_document_element
from .elements.list_document_elements import list_document_elements
from .elements.move_document_element import move_document_element
from .elements.move_document_element_to_page import move_document_element_to_page
from .elements.update_document_element_attributes import update_document_element_attributes
from .labels.association_config import (
DEFAULT_ASSOCIATION_CONFIG,
MAX_PAIRS,
MIN_PAIRS,
sanitize_association_config,
)
from .labels.element_kind_labels import (
CONTENT_KINDS,
ELEMENT_KIND_LABELS,
ELEMENT_LIBRARY,
MINIGAME_KINDS,
element_default_attributes,
)
from .labels.memory_config import (
CARD_MODES,
DEFAULT_MEMORY_CONFIG,
MAX_CARDS,
MIN_CARDS,
sanitize_memory_config,
)
from .labels.mots_config import (
DEFAULT_MOTS_CONFIG,
MAX_WORDS,
MIN_WORDS,
sanitize_mots_config,
)
from .labels.quiz_config import (
DEFAULT_QUIZ_CONFIG,
MAX_CHOICES,
MAX_TIMER_SECONDS,
MIN_CHOICES,
MIN_TIMER_SECONDS,
quiz_total_points,
sanitize_quiz_config,
)
from .labels.sanitize_element_attributes import sanitize_element_attributes
from .labels.scenario_config import (
DEFAULT_SCENARIO_CONFIG,
MAX_SCENARIO_CHOICES,
sanitize_scenario_config,
)
from .pages.add_document_page import add_document_page
from .pages.delete_document_page import delete_document_page
from .pages.get_document_page import get_document_page
from .pages.list_document_pages import list_document_pages
from .pages.move_document_page import move_document_page
from .pages.replace_document_content import replace_document_content
from .pages.set_document_page_vertical_align import VERTICAL_ALIGNS, set_document_page_vertical_align
from .pages.update_document_page import update_document_page
from .rendering.render_document_element import render_document, render_document_element
from .rendering.sanitize_svg_markup import sanitize_svg_markup
from .themes.seed_blocks_to_elements import seed_blocks_to_elements
from .themes.theme_catalog import DOCUMENT_THEMES, get_document_theme_entry
__all__ = [
"CARD_MODES",
"CONTENT_KINDS",
"DEFAULT_ASSOCIATION_CONFIG",
"DEFAULT_MEMORY_CONFIG",
"DEFAULT_MOTS_CONFIG",
"DEFAULT_QUIZ_CONFIG",
"DEFAULT_SCENARIO_CONFIG",
"DOCUMENT_THEMES",
"ELEMENT_KIND_LABELS",
"ELEMENT_LIBRARY",
"MAX_CARDS",
"MAX_CHOICES",
"MAX_PAIRS",
"MAX_SCENARIO_CHOICES",
"MAX_TIMER_SECONDS",
"MAX_WORDS",
"MIN_CARDS",
"MIN_CHOICES",
"MIN_PAIRS",
"MIN_TIMER_SECONDS",
"MIN_WORDS",
"MINIGAME_KINDS",
"VERTICAL_ALIGNS",
"add_document_element",
"add_document_page",
"delete_document_element",
"delete_document_page",
"element_default_attributes",
"get_document_element",
"get_document_page",
"get_document_theme_entry",
"list_document_elements",
"list_document_pages",
"move_document_element",
"move_document_element_to_page",
"move_document_page",
"quiz_total_points",
"render_document",
"render_document_element",
"replace_document_content",
"sanitize_association_config",
"sanitize_element_attributes",
"sanitize_memory_config",
"sanitize_mots_config",
"sanitize_quiz_config",
"sanitize_scenario_config",
"sanitize_svg_markup",
"seed_blocks_to_elements",
"set_document_page_vertical_align",
"update_document_element_attributes",
"update_document_page",
]