Atrium — shared contracts and the typesetting engine
    Preparing search index...

    Variable preferencesSchemaConst

    preferencesSchema: ZodObject<
        {
            fontSettings: ZodOptional<
                ZodObject<
                    {
                        family: ZodOptional<ZodEnum<["reading", "ui"]>>;
                        lineSpacing: ZodOptional<ZodNumber>;
                        margins: ZodOptional<ZodNumber>;
                        size: ZodOptional<ZodNumber>;
                    },
                    "passthrough",
                    ZodTypeAny,
                    objectOutputType<
                        {
                            family: ZodOptional<ZodEnum<["reading", "ui"]>>;
                            lineSpacing: ZodOptional<ZodNumber>;
                            margins: ZodOptional<ZodNumber>;
                            size: ZodOptional<ZodNumber>;
                        },
                        ZodTypeAny,
                        "passthrough",
                    >,
                    objectInputType<
                        {
                            family: ZodOptional<ZodEnum<["reading", "ui"]>>;
                            lineSpacing: ZodOptional<ZodNumber>;
                            margins: ZodOptional<ZodNumber>;
                            size: ZodOptional<ZodNumber>;
                        },
                        ZodTypeAny,
                        "passthrough",
                    >,
                >,
            >;
            pageMode: ZodOptional<ZodEnum<["paged", "scroll"]>>;
            theme: ZodOptional<ZodEnum<["light", "sepia", "dark"]>>;
            tocSidebarOpen: ZodOptional<ZodBoolean>;
        },
        "passthrough",
        ZodTypeAny,
        objectOutputType<
            {
                fontSettings: ZodOptional<
                    ZodObject<
                        {
                            family: ZodOptional<ZodEnum<["reading", "ui"]>>;
                            lineSpacing: ZodOptional<ZodNumber>;
                            margins: ZodOptional<ZodNumber>;
                            size: ZodOptional<ZodNumber>;
                        },
                        "passthrough",
                        ZodTypeAny,
                        objectOutputType<
                            {
                                family: ZodOptional<ZodEnum<["reading", "ui"]>>;
                                lineSpacing: ZodOptional<ZodNumber>;
                                margins: ZodOptional<ZodNumber>;
                                size: ZodOptional<ZodNumber>;
                            },
                            ZodTypeAny,
                            "passthrough",
                        >,
                        objectInputType<
                            {
                                family: ZodOptional<ZodEnum<["reading", "ui"]>>;
                                lineSpacing: ZodOptional<ZodNumber>;
                                margins: ZodOptional<ZodNumber>;
                                size: ZodOptional<ZodNumber>;
                            },
                            ZodTypeAny,
                            "passthrough",
                        >,
                    >,
                >;
                pageMode: ZodOptional<ZodEnum<["paged", "scroll"]>>;
                theme: ZodOptional<ZodEnum<["light", "sepia", "dark"]>>;
                tocSidebarOpen: ZodOptional<ZodBoolean>;
            },
            ZodTypeAny,
            "passthrough",
        >,
        objectInputType<
            {
                fontSettings: ZodOptional<
                    ZodObject<
                        {
                            family: ZodOptional<ZodEnum<["reading", "ui"]>>;
                            lineSpacing: ZodOptional<ZodNumber>;
                            margins: ZodOptional<ZodNumber>;
                            size: ZodOptional<ZodNumber>;
                        },
                        "passthrough",
                        ZodTypeAny,
                        objectOutputType<
                            {
                                family: ZodOptional<ZodEnum<["reading", "ui"]>>;
                                lineSpacing: ZodOptional<ZodNumber>;
                                margins: ZodOptional<ZodNumber>;
                                size: ZodOptional<ZodNumber>;
                            },
                            ZodTypeAny,
                            "passthrough",
                        >,
                        objectInputType<
                            {
                                family: ZodOptional<ZodEnum<["reading", "ui"]>>;
                                lineSpacing: ZodOptional<ZodNumber>;
                                margins: ZodOptional<ZodNumber>;
                                size: ZodOptional<ZodNumber>;
                            },
                            ZodTypeAny,
                            "passthrough",
                        >,
                    >,
                >;
                pageMode: ZodOptional<ZodEnum<["paged", "scroll"]>>;
                theme: ZodOptional<ZodEnum<["light", "sepia", "dark"]>>;
                tocSidebarOpen: ZodOptional<ZodBoolean>;
            },
            ZodTypeAny,
            "passthrough",
        >,
    > = ...

    The profiles.preferences JSON blob (the profiles work's spec, revising D9 for preferences only): theme, font settings, page mode and TOC sidebar, stored server-side so they follow a person to another device.

    Every field is optional and unknown keys pass through — both are load-bearing, and the instinct to tighten this into a strict schema would break the feature twice over:

    1. A profile that has never written preferences has no blob at all (preferences is NULL until the first PATCH), and the migration deliberately does not write one. {} must parse.
    2. Brief step 8 requires that "an older client can't silently strip a newer client's preference". Two devices share one profile row; if the older one parses, drops what it doesn't recognise, and PATCHes the whole blob back, the newer device's setting is destroyed with no error anywhere. .passthrough() carries the unknown key through the round trip.