A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
/* Copyright 2026 Marimo. All rights reserved. */
import { Facet } from "@codemirror/state";
/**
* A facet that combines a single value.
*
* This is useful for creating a facet that can be used to store a single value.
*
* @example
* ```ts
* const myFacet = singleFacet<string>();
* const myValue = myFacet.of("hello");
* ```
*/
export function singleFacet<T>() {
return Facet.define<T, T>({
combine: (values) => {
// oxlint-disable-next-line typescript/no-non-null-assertion
return values.find((v) => v !== undefined)!;
},
});
}