MCPcopy Create free account
hub / github.com/danja/dogalog / createMappingSection

Function createMappingSection

src/ui/template.js:143–197  ·  view source on GitHub ↗

* Create the mapping section (top goal + builtins list) * @returns {HTMLElement}

()

Source from the content-addressed store, hash-verified

141 * @returns {HTMLElement}
142 */
143function createMappingSection() {
144 const mapping = document.createElement('div');
145 mapping.className = 'mapping';
146
147 const goalRow = document.createElement('div');
148 goalRow.className = 'row';
149 const strong = document.createElement('strong');
150 strong.textContent = 'Top goal:';
151 goalRow.appendChild(strong);
152 goalRow.appendChild(document.createTextNode(' '));
153 const code = document.createElement('code');
154 code.textContent = 'event(Voice, Pitch, Vel, T).';
155 goalRow.appendChild(code);
156 mapping.appendChild(goalRow);
157
158 const builtinsDiv = document.createElement('div');
159 builtinsDiv.className = 'builtins';
160
161 const builtinsTitle = document.createElement('div');
162 builtinsTitle.className = 'builtins-title';
163 builtinsTitle.textContent = 'Built-ins:';
164 builtinsDiv.appendChild(builtinsTitle);
165
166 const builtinsGrid = document.createElement('div');
167 builtinsGrid.className = 'builtins-grid';
168
169 const builtinsList = [
170 'beat(T, N)', 'phase(T, N, K)', 'every(T, Step)', 'prob(P)',
171 'choose(List, X)', 'pick(List, X)', 'cycle(List, X)', 'range(Start, End, Step, X)',
172 'rand(Min, Max, X)', 'randint(Min, Max, X)', 'eq(A,B)', 'add(A,B,C)',
173 'euc(T, K, N, B, R)', 'scale(Root, Mode, Degree, Oct, Midi)', 'chord(Root, Quality, Oct, Midi)',
174 'transpose(Note, Offset, Out)', 'rotate(List, Shift, OutList)', 'lt(A,B)', 'gt(A,B)',
175 'within(T, Start, End)', 'distinct(List)', 'cooldown(Now, Last, Gap)'
176 ];
177
178 builtinsList.forEach(builtin => {
179 const code = document.createElement('code');
180 code.textContent = builtin;
181 builtinsGrid.appendChild(code);
182 });
183
184 builtinsDiv.appendChild(builtinsGrid);
185 mapping.appendChild(builtinsDiv);
186
187 // Instruments list (moved under built-ins)
188 const instrumentsHeader = document.createElement('div');
189 instrumentsHeader.className = 'builtins-title';
190 instrumentsHeader.textContent = 'Instruments:';
191 mapping.appendChild(instrumentsHeader);
192
193 const instrumentsMapping = createInstrumentsSection();
194 mapping.appendChild(instrumentsMapping);
195
196 return mapping;
197}
198
199/**
200 * Create the instruments section

Callers 1

createAppTemplateFunction · 0.85

Calls 2

createInstrumentsSectionFunction · 0.85
createElementMethod · 0.45

Tested by

no test coverage detected