1313 * @file LogoDependencies.js
1414 * @description Explicit dependency container for the Logo execution engine.
1515 *
16- * This class makes Logo's dependencies explicit rather than accessing them
17- * through the global Activity facade, improving testability and code clarity.
16+ * This class manages Logo's explicit dependencies.
1817 */
1918
2019/**
@@ -62,7 +61,7 @@ class LogoDependencies {
6261 * @param {Function } deps.callbacks.onStopTurtle - Called when turtle stops
6362 * @param {Function } deps.callbacks.onRunTurtle - Called when turtle runs
6463 *
65- * @param { Object } [deps.meSpeak] - Optional speech synthesis object
64+
6665 */
6766 constructor ( {
6867 blocks,
@@ -73,7 +72,15 @@ class LogoDependencies {
7372 storage,
7473 config,
7574 callbacks,
76- meSpeak = null
75+
76+ instruments = null ,
77+ instrumentsFilters = null ,
78+ instrumentsEffects = null ,
79+ widgetWindows = null ,
80+ utils = null ,
81+ Singer = null ,
82+ Tone = null ,
83+ classes = null
7784 } ) {
7885 // Validate required dependencies
7986 if ( ! blocks ) {
@@ -137,11 +144,38 @@ class LogoDependencies {
137144 */
138145 this . callbacks = callbacks || { onStopTurtle : null , onRunTurtle : null } ;
139146
140- /**
141- * Speech synthesis (optional)
142- * @type {Object|null }
143- */
144- this . meSpeak = meSpeak ;
147+ // Audio and utility dependencies
148+ this . instruments =
149+ instruments || ( typeof window !== "undefined" ? window . instruments : null ) ;
150+ this . instrumentsFilters =
151+ instrumentsFilters ||
152+ ( typeof window !== "undefined" ? window . instrumentsFilters : null ) ;
153+ this . instrumentsEffects =
154+ instrumentsEffects ||
155+ ( typeof window !== "undefined" ? window . instrumentsEffects : null ) ;
156+ this . widgetWindows =
157+ widgetWindows || ( typeof window !== "undefined" ? window . widgetWindows : null ) ;
158+ this . Singer = Singer || ( typeof window !== "undefined" ? window . Singer : null ) ;
159+ this . Tone = Tone || ( typeof window !== "undefined" ? window . Tone : null ) ;
160+ this . utils = utils || {
161+ doUseCamera : typeof doUseCamera !== "undefined" ? doUseCamera : null ,
162+ doStopVideoCam : typeof doStopVideoCam !== "undefined" ? doStopVideoCam : null ,
163+ getIntervalDirection :
164+ typeof getIntervalDirection !== "undefined" ? getIntervalDirection : null ,
165+ getIntervalNumber : typeof getIntervalNumber !== "undefined" ? getIntervalNumber : null ,
166+ mixedNumber : typeof mixedNumber !== "undefined" ? mixedNumber : null ,
167+ rationalToFraction :
168+ typeof rationalToFraction !== "undefined" ? rationalToFraction : null ,
169+ getStatsFromNotation :
170+ typeof getStatsFromNotation !== "undefined" ? getStatsFromNotation : null ,
171+ delayExecution : typeof delayExecution !== "undefined" ? delayExecution : null ,
172+ last : typeof last !== "undefined" ? last : null
173+ } ;
174+ this . classes = classes || {
175+ Notation : typeof Notation !== "undefined" ? Notation : null ,
176+ Synth : typeof Synth !== "undefined" ? Synth : null ,
177+ StatusMatrix : typeof StatusMatrix !== "undefined" ? StatusMatrix : null
178+ } ;
145179 }
146180
147181 /**
@@ -179,7 +213,36 @@ class LogoDependencies {
179213 onStopTurtle : activity . onStopTurtle ,
180214 onRunTurtle : activity . onRunTurtle
181215 } ,
182- meSpeak : activity . meSpeak
216+
217+ // Pass globals for backward compatibility during migration
218+ instruments : typeof instruments !== "undefined" ? instruments : null ,
219+ instrumentsFilters :
220+ typeof instrumentsFilters !== "undefined" ? instrumentsFilters : null ,
221+ instrumentsEffects :
222+ typeof instrumentsEffects !== "undefined" ? instrumentsEffects : null ,
223+ widgetWindows : typeof window !== "undefined" ? window . widgetWindows : null ,
224+ Singer : typeof Singer !== "undefined" ? Singer : null ,
225+ Tone : typeof Tone !== "undefined" ? Tone : null ,
226+ utils : {
227+ doUseCamera : typeof doUseCamera !== "undefined" ? doUseCamera : null ,
228+ doStopVideoCam : typeof doStopVideoCam !== "undefined" ? doStopVideoCam : null ,
229+ getIntervalDirection :
230+ typeof getIntervalDirection !== "undefined" ? getIntervalDirection : null ,
231+ getIntervalNumber :
232+ typeof getIntervalNumber !== "undefined" ? getIntervalNumber : null ,
233+ mixedNumber : typeof mixedNumber !== "undefined" ? mixedNumber : null ,
234+ rationalToFraction :
235+ typeof rationalToFraction !== "undefined" ? rationalToFraction : null ,
236+ getStatsFromNotation :
237+ typeof getStatsFromNotation !== "undefined" ? getStatsFromNotation : null ,
238+ delayExecution : typeof delayExecution !== "undefined" ? delayExecution : null ,
239+ last : typeof last !== "undefined" ? last : null
240+ } ,
241+ classes : {
242+ Notation : typeof Notation !== "undefined" ? Notation : null ,
243+ Synth : typeof Synth !== "undefined" ? Synth : null ,
244+ StatusMatrix : typeof StatusMatrix !== "undefined" ? StatusMatrix : null
245+ }
183246 } ) ;
184247 }
185248
0 commit comments