Add frozen TikZRefinery demo baseline and build pipeline
vpn-dns-gateway/pipeline/head This commit looks good
vpn-dns-gateway/pipeline/pr-main This commit looks good

This commit is contained in:
2026-11-25 22:46:33 -05:00
parent 6064cce05e
commit 27b82c169e
456 changed files with 66509 additions and 0 deletions
@@ -0,0 +1,42 @@
# Shape API v1 - initial rectangle extraction
`tikzrefinery_shape_api` exports only these public headers and Qt Core.
The module implements `tkrShapeProvider`; the host loads it with Qt's native
plugin mechanism. Widgets, graphics items, byte ranges, files and history are
outside the API. This is a same-toolchain C++ contract, not a stable cross-vendor
ABI, sandbox or adapter layer. Use the exact API/schema, Qt, compiler, platform,
pointer size and Debug/Release build key in the module metadata.
Records use document centimetres and TeX-point stroke widths. An element has
document UUID, revision-scoped element ID/revision, family/type/schema, opposite
corners and appearance/content. The first provider supports black, unfilled,
empty-content rectangles. Other geometry/presentation schemas remain future work.
Operations are `tkr.move` and `tkr.resize`, parameter schema 1. Move supplies total
displacement from initial geometry; resize also supplies one of four semantic
corner IDs. Constraints contain optional fixed bounds and independent minimum
dimensions. Requests never contain source spellings or ranges. Results distinguish
PreparedChange, Unchanged and CannotPrepare with reason. A result is not acceptance.
Presentation contains an outline rectangle, selection rectangle, readable name
and four identified handle positions. The scene maps these values into its own
graphics items and constant-screen-size handles. It owns no plugin graphics item.
The edit service checks capabilities and proposal invariants, prepares exact
source replacements and the document applies guarded coordinate batches.
`tkrShapePluginStore` selects only the explicitly configured rectangle module
under `shape-plugins/`. It validates identity, role, API/data/parameter schemas,
operations and build key before activation, then pins its binding for the scene
lifetime (the Qt module remains resident for the process). A host UUID identifies
that runtime binding separately from the declared plugin ID/version. It does not
scan competing providers or choose one by load order. Candidate selection UI,
multiple-provider registration, hot updates and migration remain planned.
To build a provider, link the INTERFACE target, implement the three const methods,
use `Q_PLUGIN_METADATA` / `Q_INTERFACES`, and declare compatible metadata. The
working reference is `plugins/rectangle/`; compile a MODULE target with matching
headers/toolchain and deploy its DLL beside the app in `shape-plugins/`.
No provider function may mutate a live document, scene, history or file.
Reference: [Qt application plugins](https://doc.qt.io/qt-6/plugins-howto.html),
[QPluginLoader](https://doc.qt.io/qt-6/qpluginloader.html).
@@ -0,0 +1,93 @@
#pragma once
#include <QMetaType>
#include <QPointF>
#include <QRectF>
#include <QString>
#include <QStringList>
#include <QUuid>
#include <QVector>
namespace TikzRefinery::ShapeApi {
inline constexpr int iApiVersion = 1;
inline constexpr int iRectangleSchemaVersion = 1;
inline constexpr int iParameterSchemaVersion = 1;
inline constexpr int iCoordinateDecimals = 6;
inline constexpr qreal rCoordinateStepsPerCentimeter = 1000000.0;
inline constexpr qreal rMinimumRectangleCentimeters = 0.01;
inline constexpr qreal rCentimetersPerTexPoint = 2.54 / 72.27;
inline constexpr qreal rHalfStroke = 0.5;
inline constexpr qreal rDefaultLineWidthPoints = 0.4;
inline const QString strMoveOperation = QStringLiteral("tkr.move");
inline const QString strResizeOperation = QStringLiteral("tkr.resize");
inline const QString strRectangleFamily = QStringLiteral("rectangle");
inline const QString strRectangleType = QStringLiteral("tkr.rectangle.opposite-corners");
enum class HandleId { FirstFirst, FirstSecond, SecondFirst, SecondSecond };
enum class PreparationOutcome { PreparedChange, Unchanged, CannotPrepare };
// Value records in document centimetres. No source ranges, widgets or item pointers.
struct ElementDescription
{
QUuid documentId;
quint64 uElementId = 0;
quint64 uRevision = 0;
QString strFamily = strRectangleFamily;
QString strType = strRectangleType;
int iSchemaVersion = iRectangleSchemaVersion;
QPointF ptFirstCentimeters;
QPointF ptSecondCentimeters;
qreal rLineWidthPoints = rDefaultLineWidthPoints;
QString strStrokeColor = QStringLiteral("black");
QString strContent;
};
struct HandleDescription
{
HandleId handleId = HandleId::FirstFirst;
QPointF ptPositionCentimeters;
};
struct PresentationDescription
{
bool bAvailable = false;
QString strReason;
QString strReadableDescription;
QRectF rectOutlineCentimeters;
QRectF rectSelectionCentimeters;
QVector<HandleDescription> vecHandles;
};
struct EditingConstraints
{
bool bHasFixedBounds = false;
QRectF rectBoundsCentimeters;
qreal rMinimumWidthCentimeters = rMinimumRectangleCentimeters;
qreal rMinimumHeightCentimeters = rMinimumRectangleCentimeters;
};
struct OperationRequest
{
QUuid documentId;
quint64 uElementId = 0;
quint64 uRevision = 0;
ElementDescription initial;
QString strOperationId;
int iParameterSchemaVersion = ShapeApi::iParameterSchemaVersion;
QPointF ptTotalDisplacementCentimeters;
HandleId handleId = HandleId::SecondSecond;
EditingConstraints constraints;
};
struct PreparationResult
{
PreparationOutcome outcome = PreparationOutcome::CannotPrepare;
ElementDescription proposed;
QString strReason;
};
} // namespace TikzRefinery::ShapeApi
Q_DECLARE_METATYPE(TikzRefinery::ShapeApi::ElementDescription)
Q_DECLARE_METATYPE(TikzRefinery::ShapeApi::PresentationDescription)
@@ -0,0 +1,23 @@
#pragma once
#include "ShapeTypes.h"
#include <QtPlugin>
#define TKR_SHAPE_PROVIDER_IID "org.tikzrefinery.ShapeProvider/1.0"
namespace TikzRefinery {
// Strategy interface; native modules require the exact documented build contract.
class tkrShapeProvider
{
public:
virtual ~tkrShapeProvider() = default;
virtual QStringList availableOperations(const ShapeApi::ElementDescription &description) const = 0;
virtual ShapeApi::PresentationDescription describePresentation(
const ShapeApi::ElementDescription &description) const = 0;
virtual ShapeApi::PreparationResult prepareOperation(const ShapeApi::OperationRequest &request) const = 0;
};
} // namespace TikzRefinery
Q_DECLARE_INTERFACE(TikzRefinery::tkrShapeProvider, TKR_SHAPE_PROVIDER_IID)