Tag new functions

This commit is contained in:
Václav Volhejn
2025-11-01 21:11:57 +01:00
parent 29fd541f1f
commit b7827cb89f
3 changed files with 20 additions and 35 deletions
+4
View File
@@ -2049,6 +2049,7 @@ export const { distort, dist } = registerControl(['distort', 'distortvol', 'dist
*
* @name distortvol
* @synonyms distvol
* @tags fx, superdough, supradough
* @param {number | Pattern} volume linear postgain of the distortion
* @example
* s("bd*4").bank("tr909").distort(2).distortvol(0.8)
@@ -2059,6 +2060,7 @@ export const { distortvol } = registerControl('distortvol', 'distvol');
* Type of waveshaping distortion to apply.
*
* @name distorttype
* @tags fx, superdough, supradough
* @synonyms disttype
* @param {number | string | Pattern} type type of distortion to apply
* @example
@@ -2487,6 +2489,7 @@ export const { polyTouch } = registerControl('polyTouch');
/**
* The host to send open sound control messages to. Requires running the OSC bridge.
* @name oschost
* @tags external_io
* @param {string | Pattern} oschost e.g. 'localhost'
* @example
* note("c4").oschost('127.0.0.1').oscport(57120).osc();
@@ -2496,6 +2499,7 @@ export const { oschost } = registerControl('oschost');
/**
* The port to send open sound control messages to. Requires running the OSC bridge.
* @name oscport
* @tags external_io
* @param {number | Pattern} oscport e.g. 57120
* @example
* note("c4").oschost('127.0.0.1').oscport(57120).osc();
+9
View File
@@ -3128,6 +3128,7 @@ export const extend = stepRegister('extend', function (factor, pat) {
* `stepcat("a b".fast(2), "c d")` would be the same as `"[a b] [a b] c d"`.
*
* TODO: find out how this function differs from extend
* @tags temporal
* @example
* stepcat(
* sound("bd bd - cp").replicate(2),
@@ -3697,6 +3698,7 @@ export const morph = (frompat, topat, bypat) => {
* Soft-clipping distortion
*
* @name soft
* @tags fx
* @param {number | Pattern} distortion amount of distortion to apply
* @param {number | Pattern} volume linear postgain of the distortion
*
@@ -3705,6 +3707,7 @@ export const morph = (frompat, topat, bypat) => {
* Hard-clipping distortion
*
* @name hard
* @tags fx
* @param {number | Pattern} distortion amount of distortion to apply
* @param {number | Pattern} volume linear postgain of the distortion
*
@@ -3713,6 +3716,7 @@ export const morph = (frompat, topat, bypat) => {
* Cubic polynomial distortion
*
* @name cubic
* @tags fx
* @param {number | Pattern} distortion amount of distortion to apply
* @param {number | Pattern} volume linear postgain of the distortion
*
@@ -3721,6 +3725,7 @@ export const morph = (frompat, topat, bypat) => {
* Diode-emulating distortion
*
* @name diode
* @tags fx
* @param {number | Pattern} distortion amount of distortion to apply
* @param {number | Pattern} volume linear postgain of the distortion
*
@@ -3729,6 +3734,7 @@ export const morph = (frompat, topat, bypat) => {
* Asymmetrical diode distortion
*
* @name asym
* @tags fx
* @param {number | Pattern} distortion amount of distortion to apply
* @param {number | Pattern} volume linear postgain of the distortion
*
@@ -3737,6 +3743,7 @@ export const morph = (frompat, topat, bypat) => {
* Wavefolding distortion
*
* @name fold
* @tags fx
* @param {number | Pattern} distortion amount of distortion to apply
* @param {number | Pattern} volume linear postgain of the distortion
*
@@ -3745,6 +3752,7 @@ export const morph = (frompat, topat, bypat) => {
* Wavefolding distortion composed with sinusoid
*
* @name sinefold
* @tags fx
* @param {number | Pattern} distortion amount of distortion to apply
* @param {number | Pattern} volume linear postgain of the distortion
*
@@ -3753,6 +3761,7 @@ export const morph = (frompat, topat, bypat) => {
* Distortion via Chebyshev polynomials
*
* @name chebyshev
* @tags fx
* @param {number | Pattern} distortion amount of distortion to apply
* @param {number | Pattern} volume linear postgain of the distortion
*
@@ -11,8 +11,13 @@ const availableFunctions = (() => {
for (const doc of jsdocJson.docs) {
if (!isValid(doc)) continue;
if (seen.has(doc.name)) continue;
doc.tags = doc.tags?.filter((t) => t && typeof t === 'string') || [];
// jsdoc also uses "tags" for when you use @something in the comments and it doesn't know what
// @something is. We only want data from comments like `@tags fx, superdough` here.
// If nothing is specified, we default to "untagged" for debugging
doc.tags = doc.tags?.filter((t) => t && typeof t === 'string') || ['untagged'];
functions.push(doc);
const synonyms = doc.synonyms || [];
seen.add(doc.name);
for (const s of synonyms) {
@@ -38,16 +43,6 @@ const getInnerText = (html) => {
return div.textContent || div.innerText || '';
};
const GROUP_DISPLAY_NAMES = {
external_io: 'External I/O',
effects: 'Effects',
untagged: 'Untagged',
structure: 'Structure',
transforms: 'Transforms',
};
const GROUP_ORDER = ['effects', 'transforms', 'structure', 'untagged', 'external_io'];
export function Reference() {
const [search, setSearch] = useState('');
const [selectedTag, setSelectedTag] = useState(null);
@@ -80,29 +75,6 @@ export function Reference() {
});
}, [search, selectedTag]);
const visibleFunctionsByGroup = (() => {
const groups = {};
for (const doc of visibleFunctions) {
const group = (doc.tags || ['untagged'])[0];
if (!groups[group]) {
groups[group] = [];
}
groups[group].push(doc);
}
return groups;
})();
// console.log(visibleFunctionsByGroup);
// Sort and map group entries
const sortedGroups = Object.entries(visibleFunctionsByGroup).sort(([a], [b]) => {
const ai = GROUP_ORDER.indexOf(a);
const bi = GROUP_ORDER.indexOf(b);
if (ai === -1 && bi === -1) return a.localeCompare(b);
if (ai === -1) return 1;
if (bi === -1) return -1;
return ai - bi;
});
const tagCounts = {};
for (const doc of availableFunctions) {
(doc.tags || ['untagged']).forEach((t) => {
@@ -114,7 +86,7 @@ export function Reference() {
return (
<div className="flex flex-col h-full w-full p-2">
<div className="w-full flex flex-col gap-2 h-1/3 mb-2">
<div className="w-full flex flex-col gap-2 h-2/5 mb-2">
<div className="w-full flex flex-col gap-2">
<Textbox className="w-full" placeholder="Search" value={search} onChange={setSearch} />
<div>