p5
Version:
[](https://www.npmjs.com/package/p5)
38 lines (37 loc) • 2.09 kB
JavaScript
import { t as FES } from "../fes-Dwprq5RO.js";
//#region src/core/experimental.js
const experimentalMessages = {
webgpu: "WEBGPU mode is experimental, so its functions and constants may change in future versions. You can get involved by giving feedback to help direct its development!",
"p5.strands": "p5.strands shaders are experimental, so functions for building shaders and the hooks available within them may change in future versions. You can get involved by giving feedback to help direct its development!",
"p5.strands.transforms": "p5.strands transforms are experimental, so transform2D(), transform3D(), the matrix constructors, and the functions that build on them may change in future versions. You can get involved by giving feedback to help direct their development!",
"p5.svg": "SVG features are experimental, so SVG export, import, and shape recording functions may change in future versions. You can get involved by giving feedback to help direct its development!"
};
const experimentalDocSections = { "p5.strands.transforms": {
doc: "p5.strands",
section: "transforms-and-matrices"
} };
function experimentalDocURL(subjectArea) {
const { doc = subjectArea, section } = experimentalDocSections[subjectArea] || {};
return `https://p5js.org/contribute/${doc}/${section ? `#${section}` : ""}`;
}
const globalWarningTarget = {};
function warnExperimental(p5, pInst, subjectArea) {
const target = pInst || globalWarningTarget;
if (!p5.disableFriendlyErrors && !target.warnedExperimental?.[subjectArea]) {
target.warnedExperimental = target.warnedExperimental || {};
target.warnedExperimental[subjectArea] = true;
const message = experimentalMessages[subjectArea];
const url = experimentalDocURL(subjectArea);
FES.log`${message} For more info, see ${url}`();
}
}
function markExperimental(subjectArea, p5, getPInst = (targetObj) => targetObj) {
return function(target) {
return function(...args) {
warnExperimental(p5, getPInst(this), subjectArea);
return target.apply(this, args);
};
};
}
//#endregion
export { markExperimental, warnExperimental };